the thing that I'm looking for, is a function that given "a" will return "b" by the following:
a = numpy.array([1, 1, 1, 1, 5, 5, 5, 5, 5, 6, 5, 2, 2, 2, 2])
which at first 1 shows 4 times in a row, after that 5 shows 5 times, 6 shows 1 time, 5 shows 1 and 2 shows 4 times
and what will return is an array like this:
b = numpy.array([4, 5, 1, 1, 4])
the function that im looking for will treat 5 this way, even though 5 is in the array "a" 6 times in total, it will count seperately per sequence
it is a very specific, i wrote a function like this, but i want to know if there is in numpy a built-in function like this for fast perfotmance
thanks in advance