![]() |
Seaborn is a Python data visualization library based on Matplotlib. It provides a high-level interface for drawing attractive and informative statistical graphics. In this article, we will learn about the Python seaborn.get_dataset_names() Method. What is the Seaborn get_dataset_names() Method?The seaborn.get_dataset_names() method is used to retrieve the complete list of names of all the built-in or sample datasets provided by the seaborn library. The datasets provided by the Seaborn library are returned as a Pandas dataframe which can later be used for creating visualization or analytical reports. Syntax of Python Seaborn get_dataset_names() Method
Seaborn get_dataset_names() Method ExamplesBelow are examples of Python seaborn.get_dataset_names() Method:
Loading and Visualizing a DatasetIn this example, below code uses seaborn to access built-in datasets. It retrieves the list of available datasets and loads the ‘iris’ dataset. Finally, it displays the first few rows of the ‘iris‘ dataset for visualization.
Output sepal_length sepal_width petal_length petal_width species
0 5.1 3.5 1.4 0.2 setosa
1 4.9 3.0 1.4 0.2 setosa
2 4.7 3.2 1.3 0.2 setosa
3 4.6 3.1 1.5 0.2 setosa
4 5.0 3.6 1.4 0.2 setosa Checking Dataset AvailabilityIn this example, below code imports seaborn and retrieves the list of built-in datasets. It checks if the ‘titanic‘ dataset is included in the list and prints a message indicating its availability status.
Output The 'titanic' dataset is available. Looping Through Available DatasetsIn this example, below code imports seaborn and fetches a list of built-in datasets. It then iterates through each dataset in the list, printing out the name of each dataset.
Output anagrams
anscombe
attention
brain_networks
car_crashes
diamonds
dots
dowjones
exercise
flights
fmri
geyser
glue
healthexp
iris
mpg
penguins
planets
seaice
taxis
tips
titanic |
Reffered: https://www.geeksforgeeks.org
Python |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 14 |