Grouping
Learn about different types of grouping.
We'll cover the following...
What is grouping?
Grouping is a method of dividing data into distinct sets in order to perform calculations/computations for a more thorough analysis.
Grouping by hierarchy
We just saw how much hierarchical columns bothered us. But, they’re sometimes useful. Now we’re going to see how to create hierarchical indexes. Suppose that someone asks about minimum and maximum age for each country and editor. We want to have both the country and the editor in the index. To do this, we just need to pass in a list of columns we want in the index:
Press + to interact
print(jb2.pivot_table(index=['country_live', 'ide_main'],values='age', aggfunc=[min, max]))
...