Bar charts

This is one of the most common types of visualization that almost everyone must have encountered. Bars can be drawn horizontally or vertically to represent categorical variables.

Bar charts are frequently used to distinguish objects between distinct collections in order to track variations over time. In most cases, bar charts are very convenient when the changes are large. In order to learn about bar charts, let's assume a pharmacy in Norway keeps track of the amount of Zoloft sold every month. Zoloft is a medicine prescribed to patients suffering from depression. We can use the calendar Python library to keep track of the months of the year (1 to 12) corresponding to January to December:

  1. Let's import the required libraries:

Get Hands-On Exploratory Data Analysis with Python 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.