Autumn Offers - hours only!Up to 80% off on all courses and bundles.-Close
What DataFrames are
DataFrame columns
DataFrame rows
Filtering rows and columns
Filtering data frames
Sorting rows
30. Sorting by multiple columns


Good! If you want to sort by multiple columns, it's also very easy:

hospitals = hospitals.sort_values(by=['Hospital overall rating','Hospital Name'])

The code above will first sort all rows by Hospital overall rating. Then, for rows with the same value in that column, it will sort by Hospital Name.


Sort all countries in eu_states by Accession Year, and then by GDP.

Stuck? Here's a hint!

For the by= argument, use the following value:

['Accession Year', 'GDP']