Professional Documents
Culture Documents
Part B - Program 2
Part B - Program 2
In [2]: df=pd.read_csv("tips.csv")
In [3]: df.head(10)
Out[3]:
Payer
total_bill tip sex smoker day time size price_per_person
Name
Christy
0 16.99 1.01 Female No Sun Dinner 2 8.49 356032
Cunningham
Douglas
1 10.34 1.66 Male No Sun Dinner 3 3.45 447807
Tucker
Travis
2 21.01 3.50 Male No Sun Dinner 3 7.00 601181
Walters
Nathaniel
3 23.68 3.31 Male No Sun Dinner 2 11.84 467613
Harris
Tonya
4 24.59 3.61 Female No Sun Dinner 4 6.15 483273
Carter
Kristopher
6 8.77 2.00 Male No Sun Dinner 2 4.38 222372
Johnson
Joseph
8 15.04 1.96 Male No Sun Dinner 2 7.52 352286
Mcdonald
Jerome
9 14.78 3.23 Male No Sun Dinner 2 7.39 353212
Abbott
In [4]: plt.scatter(df["day"],df["tip"])
plt.xlabel("Day")
plt.ylabel("Tip")
plt.show()
In [5]: plt.plot(df["day"],df["tip"])
plt.xlabel("Day")
plt.ylabel("Tip")
plt.show()
In [6]: plt.bar(df["day"],df["tip"])
plt.xlabel("Day")
plt.ylabel("Tip")
plt.show()
• Histogram of total_bills
In [7]: plt.hist(df["total_bill"])
plt.xlabel("Total bill")
plt.ylabel("Frequency")
plt.show()