We can customize the pandas dataframe with another technique called cross-tabulation. This allows us to cope with groupby and aggregation for better data analysis. pandas has the crosstab function, which helps when it comes to building a cross-tabulation table. The cross-tabulation table shows the frequency with which certain groups of data appear. Let's take a look:
- Let's use pd.crosstab() to look at how many different body styles cars are made by different makers:
pd.crosstab(df["make"], df["body-style"])
The output of the preceding code is as follows:
Let's apply margins and the margins_name attribute to display the ...