Locked lesson.
About this lesson
In this video, we discuss how to sort and order your data.
Exercise files
Download this lesson’s related exercise files.
Operations: Sorting, Ordering, and Finding Nulls.docx57.2 KB Operations: Sorting, Ordering, and Finding Nulls - Solution.docx
55.4 KB
Quick reference
Operations: Sorting, Ordering, and Finding Nulls
Sorting can be done using the sort_values() function.
When to use
Use the sort_values function to sort and order data in a DataFrame.
Instructions
To sort data in a particular column:
my_df.sort_values('Wed')
To sort data in a particular column in descending order:
my_df.sort_values('Wed', ascending=False)
Hints & tips
- Ascending: my_df.sort_values('Wed')
- Descending: my_df.sort_values('Wed', ascending=False)
Lesson notes are only available for subscribers.