Published Nov 28, 2022
Contribute to Docs
load_dataset() function returns a new pandas
DataFrame object that represents a sample dataset (in CSV format) from this GitHub repository.
Note: A network connection is needed to run this function since it gets information from a live URL.
seaborn.load_dataset(name, cache=True, data_home=None, **kws)
name parameter is required while the others are optional and have default values. They are usually passed as keyword arguments.
Some of the more significant parameters are listed here:
|Parameter Name||Data Type||Usage|
||Name of the dataset (in CSV format) from examples repository.|
||Initially loads the dataset from a local cache directory, after which it saves to this cache directory if a download is needed.|
||Specifies the local directory where the cache data is stored; can be viewed with
||Extra keyword arguments that are passed to the pandas
The following example accesses, loads, and prints the contents of the
flights.csv file via the
import seaborn as snsdata = sns.load_dataset("flights")print(data)
This will output the following:
year month passengers0 1949 Jan 1121 1949 Feb 1182 1949 Mar 1323 1949 Apr 1294 1949 May 121.. ... ... ...139 1960 Aug 606140 1960 Sep 508141 1960 Oct 461142 1960 Nov 390143 1960 Dec 432
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Python:Seaborn on Codecademy
Data Science FoundationsLearn to clean, analyze, and visualize data with Python and SQL.
Includes 15 Courses