Data analyst’s recipe | A waterfall chart in Python

Nilimesh Halder, PhD
Analyst’s corner
Published in
4 min readFeb 24, 2023

--

Data visualisation in Python for beginners

A waterfall chart is a type of chart that is used to visualize how a starting value (such as revenue) is affected by a series of positive or negative values (such as expenses or profits) to arrive at an ending value. In this tutorial, we will explore how to create a waterfall chart in Python using the matplotlib library.

Step 1: Install required libraries

Before we start creating our waterfall chart, we need to install the required libraries. In this tutorial, we will use the following libraries:

  • matplotlib
  • pandas

You can install these libraries using pip by running the following command in your terminal:

pip install matplotlib pandas

Step 2: Load and prepare data

We will use a sample dataset to create our waterfall chart. Here is an example dataset:

Here’s how you can convert the given data to a Pandas DataFrame:

import pandas as pd

data = [['January', 1000, 400, 600],
['February', 1200, 500, 700],
['March', 800, 300, 500],
['April', 900, 400, 500],
['May', 1500, 700, 800]…

--

--