Seaborn is a Python library for data visualization. It is based on the matplotlib Python library. The seaborn library provides an attractive and easy-to-use interface for drawing statistical graphics. The seaborn library also integrates closely with the pandas Python library.
The seaborn library includes various datasets. For example, one can use the following Python code to see all the datasets available with the seaborn Python library.
import seaborn print(seaborn.get_dataset_names())
The output will be the following:
['anagrams', 'anscombe', 'attention', 'brain_networks', 'car_crashes', 'diamonds', 'dots', 'dowjones', 'exercise', 'flights', 'fmri', 'geyser', 'glue', 'healthexp', 'iris', 'mpg', 'penguins', 'planets', 'seaice', 'taxis', 'tips', 'titanic']
We can use the seaborn.load_dataset() function to read from any of the datasets. For example, we can use the following Python ocde to read the “tips” dataset and print the first few lines of the dataset:
import seaborn df = seaborn.load_dataset("tips") print(df.head())
The output of the above program will be:
total_bill tip sex smoker day time size 0 16.99 1.01 Female No Sun Dinner 2 1 10.34 1.66 Male No Sun Dinner 3 2 21.01 3.50 Male No Sun Dinner 3 3 23.68 3.31 Male No Sun Dinner 2 4 24.59 3.61 Female No Sun Dinner 4






0 Comments