pandas gebruiken met Seaborn

Introductie tot datavisualisatie met Seaborn

Content Team

DataCamp

Wat is pandas?

  • Python-bibliotheek voor data-analyse
  • Lees eenvoudig datasets uit csv, txt en andere bestandssoorten
  • Datasets zijn DataFrame-objecten
Introductie tot datavisualisatie met Seaborn

Werken met 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
Introductie tot datavisualisatie met Seaborn

DataFrames gebruiken met 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()

Een countplot van de kolom "how_masculine"

Introductie tot datavisualisatie met Seaborn

Eerste 10 rijen van de DataFrame ‘masculinity’

Introductie tot datavisualisatie met Seaborn

Een ‘untidy’ DataFrame

Introductie tot datavisualisatie met Seaborn

Laten we oefenen!

Introductie tot datavisualisatie met Seaborn

Preparing Video For Download...