SEABORN BUILT-IN DATASETS
Listing 5.31 displays the contents of seaborn_tips.py that illustrates how to read the tips dataset into a data frame and display the first five rows of the dataset.
Listing 5.31: seaborn_tips.py
import seaborn as sns
df = sns.load_dataset("tips")
print(df.head())
Listing 5.31 is very simple: after importing Seaborn, the variable df is initialized with the data in the built-in dataset tips, and the print() statement displays the first five rows of df. Note that the load_dataset() API searches for online or built-in datasets. The output from Listing 5.31 is here:
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