Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- df['Date_Time'] = pd.to_datetime(df['Date'].astype(str).str.cat(df['Time'].astype(str)),format='%Y%m%d%H%M%S')
- df.loc[df.groupby('Tr')['Date_Time'].idxmax()].drop('Date_Time', axis=1)
- Tr Date Time
- 0 AV81312 20161014 160221
- 1 AV85012 20170422 150858
- 2 AV86157 20170426 45747
Add Comment
Please, Sign In to add comment