Chapter 12 · 9 levels

Seaborn, correlation and conclusions

Statistical charts with seaborn (countplot, histplot, boxplot, regplot, heatmap), outliers with the IQR rule, correlation done right, and turning numbers into a written takeaway.

Start

The previous chapter drew charts piece by piece with matplotlib. seaborn is a library built on top of it for statistical charts: you hand it a DataFrame and column names, and it groups, counts and colors for you. Every seaborn function follows one pattern, sns.function(data=df, x="col", y="col", hue="col"), and returns a matplotlib Axes, so titles, labels and limits work exactly as before.

You’ll count with countplot, compare distributions with histplot and boxplot, learn to read a boxplot properly (median, quartiles, whiskers, outliers) and find outliers with numbers, not by eye. Then correlation: what the number between -1 and +1 means, how to compute a whole matrix with corr(), show it as a heatmap, pick the strongest pairs, and why “goes together” never means “causes”.

The last part is the one that turns analysis into something a manager can use: the takeaway. What did you find, how big is it, and so what? Every number in it computed, not estimated.

How it runs here. seaborn isn’t part of the Python that runs in your browser by default, so the page loads a pinned copy (and matplotlib) the first time your code says import seaborn as sns. That takes a few seconds once. As in chapter 11, your charts appear under your result, and the check looks at the numbers in result.

Levels

  1. Orders per channel with seaborn

    from Robert Kim, Chief Operating Officer

    seaborn, countplot, hue, order, value counts

    Code Difficulty 2 of 5 Not started

  2. Business baskets against consumer baskets

    from Megan Collins, Head of Sales

    seaborn, histplot, hue, kde, distribution, median

    Code Difficulty 3 of 5 Not started

  3. Read the price boxes

    from Thomas Whitaker, Head of Merchandising

    boxplot, quartiles, iqr, quantile, seaborn

    Code Difficulty 3 of 5 Not started

  4. Which orders are unusually large?

    from Laura Bennett, Head of Finance

    outliers, iqr, quantile, boxplot, fences

    Code Difficulty 3 of 5 Not started

  5. Does more ad spend bring more visits?

    from Jordan Reyes, Head of Marketing

    correlation, corr, regplot, scatterplot, pearson r

    Code Difficulty 3 of 5 Not started

  6. The correlation heatmap and the strongest pairs

    from Priya Shah, Head of Data

    correlation matrix, heatmap, corr, top pairs, abs

    Code Difficulty 4 of 5 Not started

  7. Will doubling ad spend double orders?

    from Jordan Reyes, Head of Marketing

    correlation, causation, confounder, seasonality

    Quiz Difficulty 2 of 5 Not started

  8. From numbers to a takeaway

    from Megan Collins, Head of Sales

    takeaway, conclusions, f strings, percent format, reporting

    Code Difficulty 3 of 5 Not started

  9. Boss: is it the channel or the customer?

    from Catherine Hale, Chief Executive Officer

    heatmap, pivot table, boxplot, to csv, takeaway

    Boss · 4 steps Difficulty 4 of 5 Not started

Pick what may run on this site. You can change this any time from "Cookie settings" at the bottom of every page.