Producing histograms
Histograms can help you inspect the distribution of any variable quickly. Histograms bin the observations into groups and present the count of observations in each group on a bar chart. It is a powerful and easy way to examine issues with your data as well as inspect visually if the data follows some known distribution.
In this recipe, we will produce histograms of all the prices from our dataset.
Getting ready
To run this recipe, you will need pandas
and SQLAlchemy
to retrieve the data. Matplotlib
and Seaborn
handle the presentation layer. Matplotlib
is a 2D library for scientific data presentation. Seaborn builds on Matplotlib
and provides an easier way to produce statistical charts (such as histograms, among others).
How to ...
Get Practical Data Analysis Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.