Cross-tabulation

A cross-tabulation sets two qualitative variables side by side by counting, for each combination of categories, the number of observations. It lets you examine a possible link between these variables, first in counts and then in row or column proportions. It is the basis of the chi-squared test.

Example

pd.crosstab(df['genre'], df['achat'], normalize='index')

Related concepts

The whole glossary