How to load dataset in Seaborn

You can load the dataset in Seaborn with the following code. I highly recommend you “Python Crash Course Book” to learn Python.

Load Built-in Datasets in Seaborn

You can load the built-in datasets that are available in seaborn with the following code. You have to change the name of the dataset only. These datasets are available in seaborn now.

['anagrams',
 'anscombe',
 'attention',
 'brain_networks',
 'car_crashes',
 'diamonds',
 'dots',
 'exercise',
 'flights',
 'fmri',
 'gammas',
 'geyser',
 'iris',
 'mpg',
 'penguins',
 'planets',
 'taxis',
 'tips',
 'titanic']

Example 1: Load fmri Dataset

import seaborn as sns
dataset = sns.load_dataset("fmri")

Example 2: Load iris

import seaborn as sns
dataset = sns.load_dataset("iris")

Load your own Dataset

You can import your own dataset with the following method. When you use Seaborn to load a dataset it also provides Pandas DataFrame. In both cases, the type of dataset is Pandas DataFrame.

import pandas as pd
dataset = pd.read_csv("heart.csv")

Leave a Comment

Your email address will not be published.