Using pandas with Seaborn

Introduzione alla visualizzazione dei dati con Seaborn

Content Team

DataCamp

What is pandas?

  • Python library for data analysis
  • Easily read datasets from csv, txt, and other types of files
  • Datasets take the form of DataFrame objects
Introduzione alla visualizzazione dei dati con Seaborn

Working with DataFrames

import pandas as pd

df = pd.read_csv("masculinity.csv")
df.head()
    participant_id        age    how_masculine    how_important
0                1    18 - 34         Somewhat         Somewhat
1                2    18 - 34         Somewhat         Somewhat
2                3    18 - 34             Very         Not very
3                4    18 - 34             Very         Not very
4                5    18 - 34             Very             Very
Introduzione alla visualizzazione dei dati con Seaborn

Using DataFrames with countplot()

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

df = pd.read_csv("masculinity.csv")
sns.countplot(x="how_masculine", data=df)
plt.show()

A count plot of the "how_masculine" column

Introduzione alla visualizzazione dei dati con Seaborn

First 10 rows of the masculinity DataFrame

Introduzione alla visualizzazione dei dati con Seaborn

An "untidy" DataFrame

Introduzione alla visualizzazione dei dati con Seaborn

Let's practice!

Introduzione alla visualizzazione dei dati con Seaborn

Preparing Video For Download...