Challenge - 5 Problems
Categorical Plot Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of boxplot with grouped categories
What will be the output of the following code snippet that creates a boxplot grouped by category?
Data Analysis Python
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt data = pd.DataFrame({ 'Category': ['A', 'A', 'B', 'B', 'C', 'C'], 'Value': [10, 15, 10, 20, 15, 25] }) sns.boxplot(x='Category', y='Value', data=data) plt.show()
Attempts:
2 left
💡 Hint
Boxplots show distribution of values grouped by categories.
✗ Incorrect
The boxplot groups data by 'Category' and shows the distribution of 'Value' for each group as boxes.
❓ data_output
intermediate1:30remaining
Number of boxes in violinplot
Given the following data and code, how many violin shapes will appear in the plot?
Data Analysis Python
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt data = pd.DataFrame({ 'Group': ['X', 'X', 'Y', 'Y', 'Y', 'Z'], 'Score': [5, 7, 6, 8, 7, 9] }) sns.violinplot(x='Group', y='Score', data=data) plt.show()
Attempts:
2 left
💡 Hint
Each unique category in 'Group' creates one violin shape.
✗ Incorrect
There are three unique groups: X, Y, and Z, so the violinplot will have three violins.
❓ visualization
advanced1:30remaining
Identify the plot type from description
Which plot type best shows the distribution shape and individual data points for categories?
Attempts:
2 left
💡 Hint
One plot type shows a smooth density shape and can include individual points.
✗ Incorrect
Violinplots show the distribution shape as a smooth density and can overlay individual data points, unlike boxplots which show summary statistics only.
🔧 Debug
advanced1:30remaining
Error in boxplot code
What error will this code produce and why?
import seaborn as sns
import matplotlib.pyplot as plt
sns.boxplot(x='Category', y='Value')
plt.show()
Data Analysis Python
import seaborn as sns import matplotlib.pyplot as plt sns.boxplot(x='Category', y='Value') plt.show()
Attempts:
2 left
💡 Hint
Seaborn needs data argument to know where to find columns.
✗ Incorrect
The code misses the 'data' argument, so seaborn cannot find 'Category' and 'Value' columns, causing a TypeError.
🚀 Application
expert2:30remaining
Choosing plot for comparing distributions with many categories
You have a dataset with 20 categories and want to compare the distribution of a numeric variable across them. Which plot is best to use and why?
Attempts:
2 left
💡 Hint
Consider clarity and compactness when many categories exist.
✗ Incorrect
Boxplots summarize distributions with quartiles and outliers, making them easier to read when many categories exist. Violinplots can become cluttered with many categories.