Having Pandas dataframe with one column like that:
I would like to create ID column based on groupby() logics of time
column like this:
Know how to do that incrementally: using index
as a column or using groupby()
with rank
function:
df['ID'] = df.groupby('time')['time'].rank(method='first')
But how can it be done using the requested way?
Thanks!