How to plot two DataFrame columns in pandas?

Today we will learn how to plot multiple specific columns of a pandas DataFrame against each other in pandas bar, scatter, line and histogram charts. We will start by importing the pandas library and then create an example DataFrame. Plot two columns in the same scatter chart Creating a scatter with pandas is relatively simple. … Read more

How to plot multiple pandas time series in a chart?

In today’s data visualization we will learn how to plot multiple time series on the same chart with pandas. Time series is basically information that is time dependent such as prices, inventory, sales etc’. In our example, we would like to plot revenue, expenses and ultimately profit for a fictitious business. We’ll use a line … Read more

How to plot vertical lines in Pandas and matplotlib?

In this Data Visualization tutorial, we will learn how to draw one or multiple vertical lines using matplotlib and Pandas. Drawing vertical lines in Pandas and Matplotlib The plt.axvline() method allows to easily add vertical lines to plots we rended using matplotlib, pandas and Seaborn. Here’s a simple example: Step #1: Import Data Analysis libraries … Read more

Solve the TypeError no numeric data to plot in Pandas

In today’s tutorial we’ll learn how to troubleshoot a common plotting error that you might encounter when working in Pandas and trying to plot your data during its pre processing for data analysis. Reproducing the problem In order to reproduce the error, we will first construct a very simple DataFrame. Your Python development environment (Jupyter, … Read more

How to add a legend in a Matplotlib chart?

In today’s hands on data visualization tutorial we’ll learn how to insert a legend into an existing chart. Rendering a Matplotlib chart We’ll use Python and the Matplotlib library to draw a simple line chart. In our example we would like to show the revenue from B2B vs B2C sales of an imaginary company during … Read more