A compendium of useful/interesting/inspirational usage of pandas functions, each example will be an ipynb file

What is this repository?

When you browse through Stackoverflow or reading blogs on Toward Data Science, have you ever encountered some super elegant solutions (maybe just one line) that can replace your dozens of lines codes (for loop, functions)?

This repository aims to store these impressive solutions in pandas and the associated examples. Each real-world task will be presented as a jupyter files to make it easy to follow step by step.

If we want to know more about the motivation, Read the blog I published on Toward Data Science:


Please feel free to create pull request for these kinds of pandas usages that occur in your daily coding.


  1. What is pandas Index object?
  2. What is pandas Series object?
  3. 80% of errors may attribute to wrong usage of pandas dtype.
  4. cross_tab function
  5. combine two columns to a dictionary.
  6. When should use squeeze function?
  7. How to bounce between long and wide form dataframe?
  8. Two dataframes, how to only keep common rows between two, or common columns?
  9. How to customize the order of dataframe columns? based on user-defined criterion?
  10. How to read R format data?