liveBook · Manning

Seaborn

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

Seaborn is a Python statistical data-visualization library that provides a high-level interface for drawing attractive and informative graphics.

Seaborn is a Python statistical visualization library that offers a high-level API on top of Matplotlib, emphasizing attractive plots with little customization. section 11.0 section 11.16

Choose a function according to the insight you want to investigate:

  • Use sns.relplot for relationships among numeric columns, including scatter and line plots. section 11.16
  • Use sns.catplot for relationships involving categorical columns, such as city-based temperature comparisons and boxplots. section 11.16
  • Use sns.displot to examine distributions, including overall or category-separated histograms. section 11.16
  • Use sns.regplot to visualize regression models. section 11.16

Compare taxi distance and fares

After loading January and July 2020 taxi records, derive year, month, and day columns, filter to the target months, reset the index, and sample 1% of the rows. Then plot trip distance against total amount, coloring points by passenger count: sns.relplot(x='trip_distance', y='total_amount', data=df, hue='passenger_count'). Extend the exercise with daily line plots and monthly fare boxplots. section 11.17 section 11.18

Figure 11.1 Screenshot of a Jupyter notebook combining code and plots

Inspect how a Jupyter notebook can keep data, code, and rendered plots together for sharing and feedback. section 11.0

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

How deep it goes
Explains four plot families, semantic parameters, faceting, and preprocessing, without detailing Matplotlib internals.
Examples
Uses weather data for relational, categorical, distribution, and faceted plots, then applies Seaborn to New York City taxi records.
What it assumes
Assumes familiarity with Python data frames, pandas filtering and grouping, and basic plotting concepts while simplifying Matplotlib configuration.
What you can do after
Apply it via Seaborn to build scatter plots, line plots, histograms, boxplots, and faceted comparisons from prepared data frames.
How it connects
Connects Seaborn with pandas, Matplotlib, Jupyter notebooks, data frames, grouping, filtering, and sampling.

Also explained in

Compare how 3 books explain seaborn →

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.