Seaborn: Importing Datasets and Libraries

Here we will learn about how to import datasets and libraries in seaborn.

Importing Libraries

Firstly we will import all the required libraries. These are some libraries that are required:

  • Pandas: It is required because it can manage datasets.
  • Matplotlib: If there are some additional customisation required.
  • Seaborn: It is used for plotting and styling.
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

 Importing Datasets

Seaborn comes with some of datasets in its library. When seaborn gets installed these datasets gets downloaded automatically.

We can load these dataset using a function given below:

load_dataset()

Now we will import the dataset. These dataset behaves like panadas dataframe. We can perform same function on these dataset as we do on panadas dataframe.

data=sns.load_dataset('flights')
data.head(5)

Output:

ss

We can also view the name of all the datasets in the Seaborn library, by using the following command:

sns.get_dataset_names()

Output

['anagrams',
 'anscombe',
 'attention',
 'brain_networks',
 'car_crashes',
 'diamonds',
 'dots',
 'exercise',
 'flights',
 'fmri',
 'gammas',
 'geyser',
 'iris',
 'mpg',
 'penguins',
 'planets',
 'taxis',
 'tips',
 'titanic']
Tue, 01/11/2022 - 09:17

Authored by

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.