I am trying to generate a unique index column in my dataset.
I have a column in my dataset as follows: 665678, 665678, 665678, 665682, 665682, 665682, 665690, 665690
And I would like to generate a separately indexed column looking like this: 1, 1, 1, 2, 2, 2, 3, 3
I came across the post How to index columns uniquely?? that describes exactly what I am trying to do. But since the solutions are described for R, I wanted to know how can I implement the same in Python using Pandas.
Thanks