Finding the Largest Values of a Column
In the last chapter, you learned how to output the smallest values; you can definitely do the same with the largest ones. To do so, you will use a very similar method with the same argument as the previous one: .nlargest()
. Look at the example of how to output the 10 newest cars, also sorted by 'Engine_volume'
- all duplicates included:
data.nlargest(10, ['Year', 'Engine_volume'], keep = 'all')
Thanks for your feedback!
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Can you explain what the 'keep' parameter does in this context?
What happens if there are ties in the 'Year' and 'Engine_volume' columns?
Can I use .nlargest() with just one column instead of two?
Awesome!
Completion rate improved to 3.03
Finding the Largest Values of a Column
Swipe to show menu
In the last chapter, you learned how to output the smallest values; you can definitely do the same with the largest ones. To do so, you will use a very similar method with the same argument as the previous one: .nlargest()
. Look at the example of how to output the 10 newest cars, also sorted by 'Engine_volume'
- all duplicates included:
data.nlargest(10, ['Year', 'Engine_volume'], keep = 'all')
Thanks for your feedback!