I checked this question and others on SO but the trick is always summing True or False values.
My case is the following array :
arr = [1,2,3,3,4,5,6,1,1,1,5,5,8,8,8,9,4,4,4]
I want to get for each member of the array the length of the "current" streak of repeated value.
For the example above I would like to get :
res = [1,1,1,2,1,1,1,1,2,3,1,2,1,2,3,1,1,2,3]
I could write a dumb loop but is there a clever or already built-in way to do this in numpy/pandas ?