How to Make a Histogram with Pandas in a Python-powered Jupyter Notebook
Documentation for creating a Histogram with Python, Pandas and Jupyter notebook.
8 min readApr 15, 2022
A histogram is a powerful (and quick) way to visualize data in Python, especially if you’re working with Pandas dataframes.
In this tutorial, we’ll create a dataframe from a public API request. Then, I’ll show you how to create a histogram, and then customize that histogram by playing with number of bins, figure size, and x-axis range. We’ll also add axis labels, a title, and some annotations.
Soccer fan? Great. You’ll love this tutorial, as we’ll be using the Fantasy Premier League API as our data source.
Let’s do it.
Table of Contents:
- Set up notebook
- Get some data
- Create dataframe
- Plot Histogram
- Updating Histogram (bins, size, colors)
- Add axis labels and title
- Annotation
- Adding a vertical span (rectangle) to Histogram