Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a histogram of the 'age' column using seaborn.
Data Analysis Python
import seaborn as sns import matplotlib.pyplot as plt sns.histplot(data=df, x=[1]) plt.show()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a column name that does not exist in the DataFrame.
Not putting the column name in quotes.
✗ Incorrect
The 'age' column is used to plot the histogram, so the x parameter should be 'age'.
2fill in blank
mediumComplete the code to add a kernel density estimate (KDE) plot for the 'salary' column.
Data Analysis Python
sns.kdeplot(data=df, x=[1])
plt.show() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a categorical column instead of a numeric one.
Forgetting to put the column name in quotes.
✗ Incorrect
The KDE plot is for the 'salary' column, so x should be 'salary'.
3fill in blank
hardFix the error in the code to plot a histogram with KDE overlay for the 'score' column.
Data Analysis Python
sns.histplot(data=df, x=[1], kde=True) plt.show()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the column name without quotes.
Passing the entire column data instead of the column name.
✗ Incorrect
The x parameter requires the column name as a string, so it should be 'score'.
4fill in blank
hardFill both blanks to create a histogram with KDE for the 'height' column and set the color to blue.
Data Analysis Python
sns.histplot(data=df, x=[1], kde=[2], color='blue') plt.show()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name instead of a string for x.
Setting kde to False or forgetting it.
✗ Incorrect
The x parameter should be 'height' as a string, and kde should be True to show the KDE line.
5fill in blank
hardFill all three blanks to create a KDE plot for the 'weight' column, shade the area under the curve, and set the line color to red.
Data Analysis Python
sns.kdeplot(data=df, x=[1], shade=[2], color=[3]) plt.show()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not putting the column name or color in quotes.
Setting shade to False or omitting it.
✗ Incorrect
Use 'weight' as the x column, set shade to True to fill under the curve, and color to 'red' for the line color.