Skip to main content
Albero Academy

Tidy Data & Datasets

Why Seaborn loves long-form data, and its built-in practice datasets.

Foundations8 min

Seaborn is happiest with tidy (long-form) data: one row per observation, one column per variable. Understanding this format is what lets you map columns to x, y, hue and facets so cleanly.

Long-form (tidy) data

In tidy data, each variable is its own column — so you can point Seaborn at column names for every visual channel:

tidy → easy mapping
# Tidy: columns are variables, rows are observations
# day | total_bill | tip | smoker
sns.barplot(data=tips, x="day", y="total_bill", hue="smoker")
# x, y and hue each map to a column — no reshaping needed

Built-in datasets

practice data included
sns.load_dataset("tips") # restaurant tips
sns.load_dataset("penguins") # measurements by species
sns.load_dataset("titanic") # survival data
sns.get_dataset_names() # list them all

Key takeaways

  1. 01Seaborn expects tidy/long-form data: one row per observation, one column per variable.
  2. 02Tidy data lets you map columns to x, y, hue and facets directly.
  3. 03Reshape wide data to long with pandas.melt first.
  4. 04Built-in datasets (tips, penguins, titanic) via sns.load_dataset() are great for practice.

Finished this chapter?

Mark it complete to track your progress through Seaborn.