Pandas & Data Analysis·Pandas from first Series to analysis project

Visualisation

Plot from Pandas and choose the chart that answers the question.

Beginner 13 min read Lesson 9 of 300 Challenge included
What you will be able to do
  • Use df.plot for quick charts.
  • Choose bars for categories and lines for time.
  • Label axes and units.
  • Export at a readable size.

In plain English

A chart is an argument. A bar chart compares categories, a line chart shows change over time and a histogram shows a distribution. Label the axes and keep the palette restrained.

chart.pyPython
import pandas as pd
import matplotlib.pyplot as plt

df = pd.DataFrame({'course': ['HTML', 'CSS', 'SQL'], 'minutes': [12, 18, 9]})
ax = df.plot.bar(x='course', y='minutes', legend=False)
ax.set_ylabel('Minutes')
plt.tight_layout()
plt.savefig('minutes.png', dpi=150)
Your turn

Make a bar chart

Easy

Plot minutes by course as a bar chart without a legend.

PYTHON · starter
df.plot()
Check your understanding before moving on.
Knowledge checkQuestion 1

Which chart best shows a trend over time?

Select an answer to continue
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Next: Analysis project
Lesson 9 of 300 · 0% of course