I am looking for the 10 IDs that have the highest a value at each date.
for date in df:
a = df.nlargest(10, ['a'])
Top_performer.append(a[['ID','Renta','Date']])
as output I would like the IDs and their 'renta' for each date
I'm bothering you for something pretty simple I guess but I'm stuck! thanks
This is a possible solution:
Code:
>>> df.groupby("Date").apply(lambda x: x.nlargest(10, "Renta")).reset_index(drop=True))