0
0
Pandasdata~10 mins

Line plots with plot() 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 create a line plot of the 'sales' column from the DataFrame.

Pandas
df.[1](y='sales')
Drag options to blanks, or click blank then click option'
Ahist
Bplot
Cshow
Dscatter
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'show' instead of 'plot' which does not exist on DataFrame.
Using 'scatter' which creates scatter plots, not line plots.
Using 'hist' which creates histograms, not line plots.
2fill in blank
medium

Complete the code to plot the 'temperature' column with a red line.

Pandas
df.plot(y='temperature', color='[1]')
Drag options to blanks, or click blank then click option'
Agreen
Bblue
Cred
Dyellow
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a color other than red when the instruction asks for red.
Using color names that are not recognized by matplotlib.
3fill in blank
hard

Fix the error in the code to plot the 'profit' column as a line plot.

Pandas
df.[1](y='profit')
Drag options to blanks, or click blank then click option'
Aplot
Bshow
Cdraw
Dline
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'show' which is a pyplot function, not a DataFrame method.
Using 'draw' or 'line' which are not valid DataFrame methods.
4fill in blank
hard

Fill both blanks to create a line plot of 'revenue' with a dashed green line.

Pandas
df.plot(y='[1]', linestyle='[2]', color='green')
Drag options to blanks, or click blank then click option'
Arevenue
Bsales
C--
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong column name for 'y'.
Using a solid line '-' instead of dashed '--'.
5fill in blank
hard

Fill both blanks to plot 'expenses' with a blue dotted line and label the plot 'Expenses Over Time'.

Pandas
df.plot(y='[1]', color='[2]', linestyle=':', title='Expenses Over Time')
Drag options to blanks, or click blank then click option'
Aexpenses
Bblue
C:
Dprofit
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong column name like 'profit'.
Using solid or dashed lines instead of dotted.
Choosing a color other than blue.