This is my below data frame "df" sorted by date
item price date
A 11.2 2021-12-31
B 32.4 2021-12-31
C 75.5 2021-12-31
A 89.3 2021-12-30
B 12.2 2021-12-30
C 14.2 2021-12-30
basically I just need the Data at the last available date
i.e
item price date
A 11.2 2021-12-31
B 32.4 2021-12-31
C 75.5 2021-12-31
I tried the same with the below code , its not work as expected. I am new to pandas kindly help.
df = df.set_index(['date'])
df = df.loc[df['date'][0]]