liveBook · Manning

Catplot

As explained in Pandas Workout: 200 exercises to make you a stronger data analyst

catplot is a Seaborn figure-level function for visualizing relationships involving categorical variables.

catplot is Seaborn’s figure-level function for comparing numeric values across categorical variables. Choose the category for x, the measured value for y, and a plot kind such as a boxplot. section 11.16 section 11.18

A typical categorical comparison follows this pattern:

  • Pass a pandas DataFrame through data. section 11.16
  • Use x for the categories being compared and y for the values being measured. section 11.18
  • Set kind='box' to compare each category’s distribution rather than displaying individual observations. section 11.18

Compare taxi fares by month

After loading January and July taxi records and deriving a month column, use sns.catplot(x='month', y='total_amount', data=df, kind='box'). The resulting boxplot compares total-amount distributions for the two months; df.groupby('month')['total_amount'].mean() supplies a numerical follow-up. section 11.18

sns.catplot(x='city', y='max_temp', data=df, kind='box')

Inspect the executable weather example that draws a boxplot of maximum temperatures for each city. section 11.16

How Pandas Workout: 200 exercises to make you a stronger data analyst covers it

How deep it goes
Explains x, y, data, and kind='box' through weather and taxi examples, without detailing Seaborn internals.
Examples
Uses city temperatures and taxi total amounts grouped by month as concrete categorical-comparison datasets.
What it assumes
Assumes familiarity with pandas DataFrames, columns, categorical fields, and basic plotting arguments.
What you can do after
Apply it via Seaborn to create boxplots that compare numeric distributions across categories.
How it connects
Connects categorical variables, boxplots, distributions, pandas DataFrames, and grouped numerical summaries.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pandas Workout: 200 exercises to make you a stronger data analyst. The section links point to the parts of the book it draws on.