- HD
- 720p
- 540p
- 360p
- 0.50x
- 0.75x
- 1.00x
- 1.25x
- 1.50x
- 1.75x
- 2.00x
We hope you enjoyed this lesson.
Cool lesson, huh? Share it with your friends
About this lesson
In this video, we begin discussing data visualization, and install matplotlib to help us create histograms.
Exercise files
Download this lesson’s related exercise files.
Plotting Histograms57.1 KB Plotting Histograms - Solution
56.7 KB
Quick reference
Plotting Histograms
We can use matplotlib to plot charts and graphs, including a histogram.
When to use
Use this to create a histogram.
Instructions
To create a histogram, use the .hist() function on a column of your DataFrame:
my_df['Wed'].hist()
To change the number of bins in the histogram:
my_df['Wed'].hist(bins=20)
You can also use the .plot() function:
my_df['Wed'].plot(kind="hist")
Hints & tips
- my_df['Wed'].hist()
- Change Bins: my_df['Wed'].hist(bins=20)
- Other Method: my_df['Wed'].plot(kind="hist")
Lesson notes are only available for subscribers.