Introduction

In this tutorial, we want to import sample datasets that are provided by Seaborn. In order to do this, we use the load_dataset() function of Seaborn.

Import Libraries

First, we import the Seaborn module:

import seaborn as sns

Overview of Seaborn Datasets

Let's get an overview of the available datasets.

sns.get_dataset_names()

In the following, we will take a closer look at some of these datasets.

Dataset 1: Flights

In order to load a Seaborn dataset into python, we use the load_dataset() function. All you have to do is using the name of the dataset as parameter. The dataset is stored in a Pandas DataFrame.

As first example we load the "flights" dataset into python.

flights_df = sns.load_dataset("flights")

flights_df.head()

Dataset 2: Penguins

Let's have a look at another sample dataset. Now, we would like to load the "penguins" dataset into python.

penguins_df = sns.load_dataset("penguins")

penguins_df.head()

Dataset 3: Taxis

Let's have a look at the "taxis" dataset.

taxis_df = sns.load_dataset("taxis")

taxis_df.head()

Dataset 4: Tips

Let's have a look at the "tips" dataset.

tips_df = sns.load_dataset("tips")

tips_df.head()

Dataset 5: Planets

Let's have a look at the "planets" dataset.

planets_df = sns.load_dataset("planets")

planets_df.head()

Conclusion

Congratulations! Now you are one step closer to become an AI Expert. You have seen that it is very easy to load sample datasets into Python. We can simply use the load_dataset() function of Seaborn. Try it yourself!

Instagram

Also check out our Instagram page. We appreciate your like or comment. Feel free to share this post with your friends.