Introduction to Data Analysis in Python

In [1]:
import pandas as pd

tips = pd.read_csv("https://milliams.com/courses/data_analysis_python/tips.csv")
In [2]:
thurs = tips[tips["day"] == "Thur"]
thurs
Out[2]:
total_bill tip day time size
77 27.20 2.80 Thur Lunch 4
78 22.76 2.10 Thur Lunch 2
79 17.29 1.90 Thur Lunch 2
80 19.44 2.10 Thur Lunch 2
81 16.66 2.38 Thur Lunch 2
... ... ... ... ... ...
202 13.00 1.40 Thur Lunch 2
203 16.40 1.75 Thur Lunch 2
204 20.53 2.80 Thur Lunch 4
205 16.47 2.26 Thur Lunch 3
243 18.78 2.10 Thur Dinner 2

62 rows × 5 columns

In [3]:
thurs["tip"].mean()
Out[3]:
1.9398387096774192
In [4]:
tips[tips["day"] == "Sat"]["tip"].mean()
Out[4]:
2.095402298850575