Seaborn Datasets For Data Science
Last Updated :
27 May, 2024
Seaborn, a Python data visualization library, offers a range of built-in datasets that are perfect for practicing and demonstrating various data science concepts. These datasets are designed to be simple, intuitive, and easy to work with, making them ideal for beginners and experienced data scientists alike.
In this article, we'll explore the different datasets available in Seaborn, their characteristics, advantages, and disadvantages, and how they can be used for various data analysis and visualization tasks.
Seaborn Datasets For Data Science
1. Tips Dataset
The Tips dataset contains information about tips received by waitstaff in a restaurant. It's commonly used for regression and exploratory data analysis (EDA). The dataset includes features such as total bill amount, tip amount, gender of the person paying the bill, whether the person is a smoker, day of the week, time of day, and size of the party.
Advantages: Simple and intuitive, good for demonstrating basic statistical analysis and visualization.
Disadvantages: Small size limits complexity of analyses, limited to restaurant tipping context.
Features and Characteristics
- total_bill: Total bill amount (numerical)
- tip: Tip amount (numerical)
- sex: Gender of the person paying the bill (categorical)
- smoker: Whether the person is a smoker (categorical)
- day: Day of the week (categorical)
- time: Time of day (Lunch/Dinner) (categorical)
- size: Size of the party (numerical)
How to load Tips Dataset?
import seaborn as sns
tips = sns.load_dataset("tips")
print(tips.head())
total_bill | tip | sex | smoker | day | time | size |
---|
16.99 | 1.01 | Female | No | Sun | Dinner | 2 |
10.34 | 1.66 | Male | No | Sun | Dinner | 3 |
21.01 | 3.50 | Male | No | Sun | Dinner | 3 |
23.68 | 3.31 | Male | No | Sun | Dinner | 2 |
24.59 | 3.61 | Female | No | Sun | Dinner | 4 |
2. Iris Dataset
The Iris dataset is one of the most famous datasets used in pattern recognition literature. It contains measurements of iris flowers from three different species. The dataset includes features such as sepal length, sepal width, petal length, petal width, and species of the iris flower.
Advantages: Widely used and well-understood, excellent for classification and clustering demonstrations.
Disadvantages: Small dataset, limited to flower measurements.
Features and Characteristics
- sepal_length: Sepal length in cm (numerical)
- sepal_width: Sepal width in cm (numerical)
- petal_length: Petal length in cm (numerical)
- petal_width: Petal width in cm (numerical)
- species: Species of the iris flower (categorical)
How to load Iris Dataset?
iris = sns.load_dataset("iris")
print(iris.head())
sepal_length | sepal_width | petal_length | petal_width | species |
---|
5.1 | 3.5 | 1.4 | 0.2 | setosa |
4.9 | 3.0 | 1.4 | 0.2 | setosa |
4.7 | 3.2 | 1.3 | 0.2 | setosa |
4.6 | 3.1 | 1.5 | 0.2 | setosa |
5.0 | 3.6 | 1.4 | 0.2 | setosa |
3. Penguins Dataset
The Penguins dataset provides measurements for three species of penguins. It includes features such as species of the penguin, island where the penguin was observed, bill length, bill depth, flipper length, body mass, and sex of the penguin.
Advantages: Good for classification and clustering, richer and more diverse than the iris dataset.
Disadvantages: Contains missing values, limited to penguin measurements.
Features and Characteristics
- species: Species of the penguin (categorical)
- island: Island where the penguin was observed (categorical)
- bill_length_mm: Bill length in mm (numerical)
- bill_depth_mm: Bill depth in mm (numerical)
- flipper_length_mm: Flipper length in mm (numerical)
- body_mass_g: Body mass in grams (numerical)
- sex: Sex of the penguin (categorical)
How to load Penguins Dataset?
penguins = sns.load_dataset("penguins")
print(penguins.head())
species | island | bill_length_mm | bill_depth_mm | flipper_length_mm | body_mass_g | sex |
---|
Adelie | Torgersen | 39.1 | 18.7 | 181 | 3750 | Male |
Adelie | Torgersen | 39.5 | 17.4 | 186 | 3800 | Female |
Adelie | Torgersen | 40.3 | 18.0 | 195 | 3250 | Female |
Adelie | Torgersen | nan | nan | nan | nan | nan |
Adelie | Torgersen | 36.7 | 19.3 | 193 | 3450 | Female |
4. Flights Dataset
The Flights dataset includes information about the number of passengers on flights over a period of years. It includes features such as year of the observation, month of the observation, and number of passengers.
Advantages: Suitable for time series analysis, simple and easy to understand.
Disadvantages: Limited to passenger data, data is somewhat outdated.
Features and Characteristics
- year: Year of the observation (numerical)
- month: Month of the observation (categorical)
- passengers: Number of passengers (numerical)
How to load flights dataset?
flights = sns.load_dataset("flights")
print(flights.head())
year | month | passengers |
---|
1949 | Jan | 112 |
1949 | Feb | 118 |
1949 | Mar | 132 |
1949 | Apr | 129 |
1949 | May | 121 |
5. Diamonds Dataset
The Diamonds dataset contains information about diamonds, including their characteristics and prices. It includes features such as carat weight, cut, color, clarity, depth, table, price, length, width, and depth in mm.
Advantages: Real-world dataset with diverse features, suitable for regression and clustering tasks.
Disadvantages: Large dataset with many features may require preprocessing, limited to diamond data.
Features and Characteristics
- carat: Carat weight of the diamond (numerical)
- cut: Quality of the cut (Fair, Good, Very Good, Premium, Ideal) (categorical)
- color: Diamond color, from D (best) to J (worst) (categorical)
- clarity: A measurement of how clear the diamond is (categorical)
- depth: Total depth percentage (numerical)
- table: Width of the top of the diamond relative to the widest point (numerical)
- price: Price in US dollars (numerical)
- x: Length in mm (numerical)
- y: Width in mm (numerical)
- z: Depth in mm (numerical)
How to load diamonds dataset?
diamonds = sns.load_dataset("diamonds")
print(diamonds.head())
carat | cut | color | clarity | depth | table | price | x | y | z |
---|
0.23 | Ideal | E | SI2 | 61.5 | 55 | 326 | 3.95 | 3.98 | 2.43 |
0.21 | Premium | E | SI1 | 59.8 | 61 | 326 | 3.89 | 3.84 | 2.31 |
0.23 | Good | E | VS1 | 56.9 | 65 | 327 | 4.05 | 4.07 | 2.31 |
0.29 | Premium | I | VS2 | 62.4 | 58 | 334 | 4.20 | 4.23 | 2.63 |
0.29 | Very Good | J | SI2 | 63.3 | 58 | 335 | 4.34 | 4.35 | 2.75 |
6. Titanic Dataset
The Titanic dataset contains information about passengers on the Titanic, including whether they survived or not. It includes features such as whether the passenger survived, ticket class, gender of the passenger, age of the passenger, number of siblings/spouses aboard the Titanic, number of parents/children aboard the Titanic, passenger fare, and port of embarkation.
Advantages: Rich dataset with various features, suitable for survival prediction and demographic analysis.
Disadvantages: Contains missing values, historical dataset may not represent modern demographics.
Features and Characteristics
- survived: Whether the passenger survived (0 = No, 1 = Yes) (categorical)
- pclass: Ticket class (1st, 2nd, 3rd) (categorical)
- sex: Gender of the passenger (categorical)
- age: Age of the passenger (numerical)
- sibsp: Number of siblings/spouses aboard the Titanic (numerical)
- parch: Number of parents/children aboard the Titanic (numerical)
- fare: Passenger fare (numerical)
- embarked: Port of embarkation (C = Cherbourg, Q = Queenstown, S = Southampton) (categorical)
How to load Titanic Dataset?
titanic = sns.load_dataset("titanic")
print(titanic.head())
survived | pclass | sex | age | sibsp | parch | fare | embarked |
---|
0 | 3 | male | 22.0 | 1 | 0 | 7.25 | S |
1 | 1 | female | 38.0 | 1 | 0 | 71.3 | C |
1 | 3 | female | 26.0 | 0 | 0 | 7.92 | S |
1 | 1 | female | 35.0 | 1 | 0 | 53.1 | S |
0 | 3 | male | 35.0 | 0 | 0 | 8.05 | S |
7. Exercise Dataset
The Exercise dataset contains information about individuals' pulse measurements after different types of exercise. It includes features such as participant ID, type of diet, pulse rate, time after exercise, and type of exercise.
Advantages: Good for time series analysis, simple and easy to understand.
Disadvantages: Limited to pulse measurements, small dataset.
Features and Characteristics
- id: Participant ID (numerical)
- diet: Type of diet (Low Fat or High Fat) (categorical)
- pulse: Pulse rate (numerical)
- time: Time after exercise (numerical)
- kind: Type of exercise (categorical)
How to load Exercise Dataset?
exercise = sns.load_dataset("exercise")
print(exercise.head())
id | diet | pulse | time | kind |
---|
1 | low | 85 | 1 | rest |
1 | low | 85 | 15 | rest |
1 | low | 88 | 30 | rest |
1 | low | 90 | 45 | rest |
1 | low | 92 | 60 | rest |
8. MPG Dataset
The MPG dataset contains information about miles per gallon for different car models and their attributes. It includes features such as miles per gallon, number of cylinders in the engine, engine displacement, engine horsepower, vehicle weight, acceleration, model year, origin of the car, and car model name.
Advantages: Real-world dataset with diverse features, suitable for regression analysis and predicting fuel efficiency.
Disadvantages: Some missing values in the horsepower column, large dataset with many features.
Features and Characteristics
- mpg: Miles per gallon (numerical)
- cylinders: Number of cylinders in the engine (numerical)
- displacement: Engine displacement in cubic inches (numerical)
- horsepower: Engine horsepower (numerical)
- weight: Vehicle weight in pounds (numerical)
- acceleration: Acceleration in seconds from 0 to 60 mph (numerical)
- model_year: Model year (categorical)
- origin: Origin of the car (1 = American, 2 = European, 3 = Japanese) (categorical)
- name: Car model name (string)
How to load MPG Dataset?
mpg = sns.load_dataset("mpg")
print(mpg.head())
mpg | cylinders | displacement | horsepower | weight | acceleration | model_year | origin | name |
---|
18.0 | 8 | 307.0 | 130.0 | 3504 | 12.0 | 70 | 1 | chevrolet chevelle ... |
15.0 | 8 | 350.0 | 165.0 | 3693 | 11.5 | 70 | 1 | buick skylark 320 |
18.0 | 8 | 318.0 | 150.0 | 3436 | 11.0 | 70 | 1 | plymouth satellite ... |
16.0 | 8 | 304.0 | 150.0 | 3433 | 12.0 | 70 | 1 | amc rebel sst |
17.0 | 8 | 302.0 | 140.0 | 3449 | 10.5 | 70 | 1 | ford torino |
9. Planets Dataset
The Planets dataset includes information about exoplanets, such as their orbital periods and masses. It includes features such as method of detecting the exoplanet, number of planets in the system, orbital period, mass of the planet, and distance from Earth.
Advantages: Unique dataset in the field of astronomy, suitable for exploring exoplanet characteristics and trends.
Disadvantages: Limited to exoplanetary data, small dataset compared to other astronomical datasets.
Features and Characteristics
- method: Method of detecting the exoplanet (categorical)
- number: Number of planets in the system (numerical)
- orbital_period: Orbital period in Earth days (numerical)
- mass: Mass of the planet in Jupiter masses (numerical)
- distance: Distance from Earth in light-years (numerical)
How to load Planets Dataset?
planets = sns.load_dataset("planets")
print(planets.head())
method | number | orbital_period | mass | distance |
---|
Radial Velocity | 1 | 269.3 | 7.1 | 77.4 |
Radial Velocity | 1 | 874.8 | 2.2 | 56.95 |
Radial Velocity | 1 | 763.0 | 2.6 | 19.84 |
Radial Velocity | 1 | 326.0 | 19.4 | 110.62 |
Radial Velocity | 1 | 516.0 | 10.5 | 119.47 |
Conclusion
Seaborn's built-in datasets provide valuable resources for practicing various data science techniques, from basic exploratory data analysis to advanced machine learning tasks. Each dataset has its own characteristics, advantages, and disadvantages, making them suitable for different applications.
By exploring and analyzing these datasets, you can gain valuable insights into data visualization, statistical analysis, and machine learning algorithms. Experimenting with different datasets and techniques is key to improving your data science skills and understanding real-world data.
Similar Reads
Data Science Tutorial Data Science is a field that combines statistics, machine learning and data visualization to extract meaningful insights from vast amounts of raw data and make informed decisions, helping businesses and industries to optimize their operations and predict future trends.This Data Science tutorial offe
3 min read
Introduction to Machine Learning
What is Data Science?Data science is the study of data that helps us derive useful insight for business decision making. Data Science is all about using tools, techniques, and creativity to uncover insights hidden within data. It combines math, computer science, and domain expertise to tackle real-world challenges in a
8 min read
Top 25 Python Libraries for Data Science in 2025Data Science continues to evolve with new challenges and innovations. In 2025, the role of Python has only grown stronger as it powers data science workflows. It will remain the dominant programming language in the field of data science. Its extensive ecosystem of libraries makes data manipulation,
10 min read
Difference between Structured, Semi-structured and Unstructured dataBig Data includes huge volume, high velocity, and extensible variety of data. There are 3 types: Structured data, Semi-structured data, and Unstructured data. Structured data - Structured data is data whose elements are addressable for effective analysis. It has been organized into a formatted repos
2 min read
Types of Machine LearningMachine learning is the branch of Artificial Intelligence that focuses on developing models and algorithms that let computers learn from data and improve from previous experience without being explicitly programmed for every task.In simple words, ML teaches the systems to think and understand like h
13 min read
What's Data Science Pipeline?Data Science is a field that focuses on extracting knowledge from data sets that are huge in amount. It includes preparing data, doing analysis and presenting findings to make informed decisions in an organization. A pipeline in data science is a set of actions which changes the raw data from variou
3 min read
Applications of Data ScienceData Science is the deep study of a large quantity of data, which involves extracting some meaning from the raw, structured, and unstructured data. Extracting meaningful data from large amounts usesalgorithms processing of data and this processing can be done using statistical techniques and algorit
6 min read
Python for Machine Learning
Learn Data Science Tutorial With PythonData Science has become one of the fastest-growing fields in recent years, helping organizations to make informed decisions, solve problems and understand human behavior. As the volume of data grows so does the demand for skilled data scientists. The most common languages used for data science are P
3 min read
Pandas TutorialPandas is an open-source software library designed for data manipulation and analysis. It provides data structures like series and DataFrames to easily clean, transform and analyze large datasets and integrates with other Python libraries, such as NumPy and Matplotlib. It offers functions for data t
6 min read
NumPy Tutorial - Python LibraryNumPy (short for Numerical Python ) is one of the most fundamental libraries in Python for scientific computing. It provides support for large, multi-dimensional arrays and matrices along with a collection of mathematical functions to operate on arrays.At its core it introduces the ndarray (n-dimens
3 min read
Scikit Learn TutorialScikit-learn (also known as sklearn) is a widely-used open-source Python library for machine learning. It builds on other scientific libraries like NumPy, SciPy and Matplotlib to provide efficient tools for predictive data analysis and data mining.It offers a consistent and simple interface for a ra
3 min read
ML | Data Preprocessing in PythonData preprocessing is a important step in the data science transforming raw data into a clean structured format for analysis. It involves tasks like handling missing values, normalizing data and encoding variables. Mastering preprocessing in Python ensures reliable insights for accurate predictions
6 min read
EDA - Exploratory Data Analysis in PythonExploratory Data Analysis (EDA) is a important step in data analysis which focuses on understanding patterns, trends and relationships through statistical tools and visualizations. Python offers various libraries like pandas, numPy, matplotlib, seaborn and plotly which enables effective exploration
6 min read
Introduction to Statistics
Statistics For Data ScienceStatistics is like a toolkit we use to understand and make sense of information. It helps us collect, organize, analyze and interpret data to find patterns, trends and relationships in the world around us.From analyzing scientific experiments to making informed business decisions, statistics plays a
12 min read
Descriptive StatisticStatistics is the foundation of data science. Descriptive statistics are simple tools that help us understand and summarize data. They show the basic features of a dataset, like the average, highest and lowest values and how spread out the numbers are. It's the first step in making sense of informat
5 min read
What is Inferential Statistics?Inferential statistics is an important tool that allows us to make predictions and conclusions about a population based on sample data. Unlike descriptive statistics, which only summarize data, inferential statistics let us test hypotheses, make estimates, and measure the uncertainty about our predi
7 min read
Bayes' TheoremBayes' Theorem is a mathematical formula used to determine the conditional probability of an event based on prior knowledge and new evidence. It adjusts probabilities when new information comes in and helps make better decisions in uncertain situations.Bayes' Theorem helps us update probabilities ba
13 min read
Probability Data Distributions in Data ScienceUnderstanding how data behaves is one of the first steps in data science. Before we dive into building models or running analysis, we need to understand how the values in our dataset are spread out and thatâs where probability distributions come in.Let us start with a simple example: If you roll a f
8 min read
Parametric Methods in StatisticsParametric statistical methods are those that make assumptions regarding the distribution of the population. These methods presume that the data have a known distribution (e.g., normal, binomial, Poisson) and rely on parameters (e.g., mean and variance) to define the data.Key AssumptionsParametric t
6 min read
Non-Parametric TestsNon-parametric tests are applied in hypothesis testing when the data does not satisfy the assumptions necessary for parametric tests, such as normality or equal variances. These tests are especially helpful for analyzing ordinal data, small sample sizes, or data with outliers.Common Non-Parametric T
5 min read
Hypothesis TestingHypothesis testing compares two opposite ideas about a group of people or things and uses data from a small part of that group (a sample) to decide which idea is more likely true. We collect and study the sample data to check if the claim is correct.Hypothesis TestingFor example, if a company says i
9 min read
ANOVA for Data Science and Data AnalyticsANOVA is useful when we need to compare more than two groups and determine whether their means are significantly different. Suppose you're trying to understand which ingredients in a recipe affect its taste. Some ingredients, like spices might have a strong influence while others like a pinch of sal
9 min read
Bayesian Statistics & ProbabilityBayesian statistics sees unknown values as things that can change and updates what we believe about them whenever we get new information. It uses Bayesâ Theorem to combine what we already know with new data to get better estimates. In simple words, it means changing our initial guesses based on the
6 min read
Feature Engineering
Model Evaluation and Tuning
Data Science Practice