Guest User

Untitled

a guest
Jan 16th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. df['Date_Time'] = pd.to_datetime(df['Date'].astype(str).str.cat(df['Time'].astype(str)),format='%Y%m%d%H%M%S')
  2. df.loc[df.groupby('Tr')['Date_Time'].idxmax()].drop('Date_Time', axis=1)
  3.  
  4. Tr Date Time
  5. 0 AV81312 20161014 160221
  6. 1 AV85012 20170422 150858
  7. 2 AV86157 20170426 45747
Add Comment
Please, Sign In to add comment