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: columns are variables, rows are observations# day | total_bill | tip | smokersns.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
sns.load_dataset("tips") # restaurant tipssns.load_dataset("penguins") # measurements by speciessns.load_dataset("titanic") # survival datasns.get_dataset_names() # list them all
Key takeaways
- 01Seaborn expects tidy/long-form data: one row per observation, one column per variable.
- 02Tidy data lets you map columns to x, y, hue and facets directly.
- 03Reshape wide data to long with pandas.melt first.
- 04Built-in datasets (tips, penguins, titanic) via sns.load_dataset() are great for practice.
