July 11, 2019 · Python tutorial

My top 25 pandas tricks (video)

In my new pandas video, you're going to learn 25 tricks that will help you to work faster, write better code, and impress your friends. These are the most useful tricks I've learned from 5 years of teaching Python's pandas library.

Each trick is about a minute long, so you're going to learn a ton of new pandas skills in less than 30 minutes!

If you want to save these tricks for reference, you can download the Jupyter notebook from GitHub.

"All of the tricks were mind blowing. But the bonus one was out of this world." - Bubai Dutta

Click on a timestamp below to jump to a particular trick:

0:00 Introduction
0:43 1. Show installed versions
1:20 2. Create an example DataFrame
2:22 3. Rename columns
3:47 4. Reverse row order
4:36 5. Reverse column order
5:01 6. Select columns by data type
5:40 7. Convert strings to numbers
6:55 8. Reduce DataFrame size
8:15 9. Build a DataFrame from multiple files (row-wise)
10:00 10. Build a DataFrame from multiple files (column-wise)
10:45 11. Create a DataFrame from the clipboard
11:50 12. Split a DataFrame into two random subsets
12:57 13. Filter a DataFrame by multiple categories
13:52 14. Filter a DataFrame by largest categories
14:42 15. Handle missing values
15:57 16. Split a string into multiple columns
16:59 17. Expand a Series of lists into a DataFrame
17:39 18. Aggregate by multiple functions
18:41 19. Combine the output of an aggregation with a DataFrame
19:56 20. Select a slice of rows and columns
20:52 21. Reshape a MultiIndexed Series
22:04 22. Create a pivot table
23:01 23. Convert continuous data into categorical data
23:56 24. Change display options
24:47 25. Style a DataFrame
26:14 Bonus. Profile a DataFrame

P.S. Want to learn even more tricks? I posted 100 tricks on this page!

Comments powered by Disqus