I am trying to filter 3 highest values from a column in a data frame without any luck. Can you please help?
I have tried Nlargest etc and it returns the top 3 rows of the highest value
I am trying to filter 3 highest values from a column in a data frame without any luck. Can you please help?
I have tried Nlargest etc and it returns the top 3 rows of the highest value
Your question is not specific enough, it can be whatever. If you want to get all rows where that match with 3 highest values, you can use:
out = df[df['colA'].isin(df.value_counts('colA').drop_duplicates().head(3))]