Pandas for SQL experts

As a SQL expert, selecting, filtering, aggregating and even advancedOLAP operations come naturally. However it is hard to wrap our minds the Pandas way of accomplish the very same tasks.

This is learning by replicating exercise. I have picked 3 SQL examples and converted them into Pandas.

Toy Data:

Here is the toy data I used for this exercise:

and here is the code to create this toy data:

3 Examples:

Note: Pandas has multiple ways of achieving the same operations. I have picked the above methods to closely mimic SQL way for ease of understanding.

For a complete reference of Pandas Transformations for SQL Experts, please see here: https://github.com/mohanganeesh/Pandas4SQLexperts

Lead Data Scientist @ Facebook