Data visualization: 1. Hello Seaborn

Time:2020-2-18

Reference source: vitu.ai

Welcome to the world of data visualization

In this learning section, you will learn how to use Seaborn to draw pictures from the primary data visualization processing to advanced drawing skills

  • This tutorial is designed for users with little programming experience, and
  • Each drawing chart will use the simplest method

If you haven’t written a lot of code, but you want to learn how to use the powerful Seaborn to draw pictures, you’ll come to the right place. First, let’s see how powerful Seaborn can draw pictures

Data visualization: 1. Hello Seaborn

Set up your notebook

The following code is the code that will be executed at the beginning of this learning chapter. Basically, the completed function is to reference the pandas, Matplotlib and Seaborn libraries that will be used. After running, you will see “setup completed”

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
Print ("setup complete")

Upload and load data

Here we will download a historical FIFA ranking data from the Internet, namely Argentina (ARG), Brazil (BRA), Spain (ESP), France (FRA), Germany (GER) and Italy (ITA). Data is stored in the form of CSV

Click here to download the dataset

Open it in Excel as follows:

Data visualization: 1. Hello Seaborn

Let’s upload the fifa.csv file to VITU’s dataset space

Data visualization: 1. Hello Seaborn

Next, we use panda to load this file:

# Path of the file to read
fifa_filepath = "fifa.csv"

# Read the file into a variable fifa_data
fifa_data = pd.read_csv(fifa_filepath, index_col="Date", parse_dates=True)

It’s time to check the data

We’ll print the first five rows of the dataset next

# Print the first 5 rows of the data
fifa_data.head()

Here comes the drawing link

In this study section, you will see all kinds of graphs. Here we draw a line graph first

# Set the width and height of the figure
plt.figure(figsize=(16,6))

# Line chart showing how FIFA rankings evolved over time 
sns.lineplot(data=fifa_data)

Data visualization: 1. Hello Seaborn

Let’s take a look at a more detailed course on line graphs.

Data visualization: 1. Hello Seaborn