At first glance, it may seem that the pivot_table method provides a unique way to analyze data. However, after a little massaging, it is possible to replicate its functionality exactly with a groupby aggregation. Knowing this equivalence can help shrink the universe of pandas functionality.
Replicating pivot_table with a groupby aggregation
Getting ready
In this recipe, we use the flights dataset to create a pivot table and then recreate it using groupby operations.
How to do it...
- Read in the flights dataset, and use the pivot_table method to find the total number of...