0
0
Pandasdata~10 mins

Histogram plots in Pandas - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to plot a histogram of the 'age' column from the DataFrame df.

Pandas
df['age'].[1](bins=10)
Drag options to blanks, or click blank then click option'
Ahist
Bbar
Cscatter
Dplot
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'plot' instead of 'hist' which creates a line plot by default.
Using 'scatter' which is for scatter plots, not histograms.
2fill in blank
medium

Complete the code to plot a histogram with 20 bins for the 'salary' column in DataFrame df.

Pandas
df['salary'].hist([1]=20)
Drag options to blanks, or click blank then click option'
Arange
Bwidth
Cbins
Dheight
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'range' which defines the interval but not the number of bins.
Using 'width' or 'height' which are not parameters for histograms.
3fill in blank
hard

Fix the error in the code to plot a histogram of 'height' with 15 bins.

Pandas
df['height'].hist(bins=[1])
Drag options to blanks, or click blank then click option'
A15
B'15'
Crange(15)
DNone
Attempts:
3 left
💡 Hint
Common Mistakes
Passing '15' as a string instead of integer 15.
Passing a range object which is not accepted.
4fill in blank
hard

Fill both blanks to create a histogram of 'weight' with 12 bins and a blue color.

Pandas
df['weight'].hist(bins=[1], color=[2])
Drag options to blanks, or click blank then click option'
A12
B'red'
C'blue'
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Using color without quotes.
Using a string for bins instead of a number.
5fill in blank
hard

Fill all three blanks to create a histogram of 'score' with 8 bins, green color, and transparency set to 0.5.

Pandas
df['score'].hist(bins=[1], color=[2], alpha=[3])
Drag options to blanks, or click blank then click option'
A10
B'green'
C0.5
D8
Attempts:
3 left
💡 Hint
Common Mistakes
Using alpha as a string instead of a number.
Using wrong number of bins.