Issue
From here I want to print the 3rd highest value along with the 'Id'. A help would be appreciated
Most_Calori_Burner.nlargest(3)
Solution
TRy this,
df.groupby('Id')['Calories'].sum().sort_values(ascending=False).reset_index().iloc[2]
- Sort your dataframe in descending order
- Reset index and take 3rd value.
Answered By - Mohamed Thasin ah
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.