Nilai Penambahan Panda dengan Kondisi
In [47]: df['ans'] = (df['ix'] != df['ix'].shift(1)).cumsum()
In [48]: df
Out[48]:
index ix ans
0 1 pa 1
1 2 pa 1
2 3 pa 1
3 4 pe 2
4 5 fc 3
5 6 pb 4
6 7 pb 4
7 8 df 5
Important Impala