Python practice: Statistical Charts with Seaborn
Chapter 30 · 8 questions · included in full access
Question 1 · easy
Why Seaborn for statistical analytics?
Solve it in your browserWhy do data scientists and analysts frequently use Seaborn alongside Matplotlib?
Question 2 · easy
Statistical bar plot with sum estimator
Solve it in your browserLoad
"sales.csv". Create a Seaborn bar plot summing Revenue by Region:fig, ax = plt.subplots(),sns.barplot(data=sales, x="Region", y="Revenue", estimator="sum", errorbar=None, ax=ax). Print the number of bars rendered (len(ax.patches)):Question 3 · medium
Segment metrics with the hue parameter
Solve it in your browserLoad
"sales.csv". Create a segmented bar plot withfig, ax = plt.subplots()andsns.barplot(data=sales, x="Region", y="Revenue", hue="Category", estimator="sum", errorbar=None, ax=ax). Print the count of rendered bar patches (len(ax.patches)):Question 4 · medium
Detect distribution spread with boxplots
Solve it in your browserLoad
"sales.csv". Create a boxplot ofRevenueacrossCategoryusingfig, ax = plt.subplots()andsns.boxplot(data=sales, x="Category", y="Revenue", ax=ax). Print the number of boxplot artists generated (len(ax.lines)):Question 5 · medium
Bivariate relationship with scatterplot
Solve it in your browserLoad
"sales.csv". Plot Units vs Revenue segmented by Category:fig, ax = plt.subplots(),sns.scatterplot(data=sales, x="Units", y="Revenue", hue="Category", ax=ax). Printlen(ax.collections):Question 6 · medium
Feature correlation matrix heatmap
Solve it in your browserLoad
"sales.csv". Compute correlationcorr = sales[["Units", "Price", "Revenue"]].corr(). Plot withfig, ax = plt.subplots()andsns.heatmap(corr, annot=True, ax=ax). Print the correlation between Units and Revenue rounded to 2 decimals (round(corr.loc["Units", "Revenue"], 2)):Question 7 · easy
Apply executive business theme and palette
Solve it in your browserSet Seaborn's global theme to
"whitegrid"usingsns.set_theme(style="whitegrid"). Create a simple bar plot of["A", "B"]and[1, 2]. Print the grid status of the axes (ax.xaxis.get_gridlines()[0].get_visible()):Question 8 · hard
Executive dashboard distribution comparison
Solve it in your browserLoad
"sales.csv". Create a figure withfig, ax = plt.subplots(). Plot a horizontal boxplot withsns.boxplot(data=sales, x="Revenue", y="Region", ax=ax). Set title"Regional Revenue Spread". Printax.get_title():
These questions are part of full access.
The first chapters of every track are free. Full access is a one-time payment.
See pricing