I'm working with some large arrays where usually values are repeated. Something similar to this:
data[0] = 10
data[1] = 10
data[2] = 12
data[3] = 12
data[4] = 13
data[5] = 9
Is there any way to get the positions where values do change. I mean, get something similar to this:
data[0] = 10
data[2] = 12
data[4] = 13
data[5] = 9
The goal is somehow compress the array so I can work with smaller arrays. I have been looking at pandas too, but without any success at the moment.
Thank you,