The groupby statement in DataFrame groups rows that have the similar values into summary rows, like "find the number of Apple Steve have". The DataFrame groupby statement is often used with aggregate functions (sum, count, mean, min, max etc.) to group the output by one or more columns.
Lets' create DataFrame with values.
Here you can see 3 names (Doe, Mike and Steve) have different kind of fruits (Apple, Orange and Grapes). So, you can have some operations on these tables using DataFrame groupby statement.
In the above image you can see some results from the above DataFrame. So, lets try to get the above result using DataFrame group by operation.
Also, you get another result to change the groupby order:
You can use the pivot functionality to arrange the data in a better grid.