![](https://static.wixstatic.com/media/7236f7_b66f29bfbdb4485ca2079496790e01bc~mv2.jpeg/v1/fill/w_125,h_83,al_c,q_80,usm_0.66_1.00_0.01,blur_2,enc_auto/7236f7_b66f29bfbdb4485ca2079496790e01bc~mv2.jpeg)
January 15, 2020
I want to get the date (when it is first seen)
the date of the last seen.
I tried :
df[0]
df['First Seen'].max()
but nothing.
A:
I think need compare by first column and first max value per group, aggregate DateFrame.first_valid_index, but maybe is better create GroupBy.first, so working solution is:
df1 = df.groupby('User ID', group_keys=False).first()
print (df1)
Date User ID
0 2019-10-01 1029
1 2019-10-01 1029
2 2019-10-01 1029
3 2019-10-01 1029
4 2019-10-01 1029
5 ac619d1d87
Related links: