I have a panel dataframe (ID and time) and want to collect the recent (latest) rows for each ID. Here is the table:
df = pd.DataFrame({'ID': [1,1,2,3] , 'Year': [2018,2019,2019,2020] , 'Var1':list("abcd") , 'Var2': list("efgh")})
and the end result would be: