...

/

Plotting Data 1: Univariate Plots

Plotting Data 1: Univariate Plots

This lesson will describe the process of plotting univariate plots of the data from a csv file in Python.

Plotting

A Plot is a way of representing data visually. It can describe relationships between variables. Plots can give insight and information about the data that may not have been easily derived by looking at the data as a table.

Almost every tool that works with spreadsheets can plot data. Python has a complete package dedicated for plotting data known as matplotlib. We will be using this package with pandas to plot data. In this lesson, we will discuss univariate plots. These are plots where a single variable is plotted.

Let’s look at an example of this using the Sample Sales Data. The data is in sales_data_sample.csv file. Have a look at the data.

sales_data.csv
Press + to interact
import pandas as pd
# Read data
df = pd.read_csv('sales_data.csv')
# Print Information
print(df.info())

Plotting individual columns

We can easily plot distributions of a single individual column for our dataframe. Let’s look at an example below. Run the code below and click on the output graph to view it in full screen.

Histograms

Histograms are plots that inform us of the underlying frequency distribution of the data. They group numbers into ranges and tells us how many values of a variable ...

Access this course and 1400+ top-rated courses and projects.