Week 2: tools - "Restaurant tips" dataset¶
Context¶
- Source: Kaggle
- Description: this dataset contains information collected from a restaurant’s bills and tips. It helps analysis how different factors — such as the total bill, gender of the customer, day of the week, meal time, and group size — influence the amount of tip given to the server.
Load dataset¶
In [1]:
import pandas as pd
import seaborn as sb
import matplotlib.pyplot as plt
df = pd.read_csv("datasets/tip.csv")
# 🧾 Display dataset informations
print("Restaurant tips dataset shape:", df.shape)
#print(df.info)
Restaurant tips dataset shape: (244, 7)
Explore content¶
In [2]:
df.head()
Out[2]:
| 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 |
Display a nice chart¶
In [7]:
sb.catplot(x="day", y="tip", kind="swarm", data=df.sample(100))
Out[7]:
<seaborn.axisgrid.FacetGrid at 0xe13cbc52f390>
In [8]:
sb.catplot(x="sex", y="tip", kind="swarm", data=df.sample(100))
Out[8]:
<seaborn.axisgrid.FacetGrid at 0xe13cbc339810>
In [ ]: