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 .. ... ... ... ... ... ... ... 239 29.03 5.92 Male No Sat Dinner 3 240 27.18 2.00 Female Yes Sat Dinner 2 241 22.67 2.00 Male Yes Sat Dinner 2 242 17.82 1.75 Male No Sat Dinner 2 243 18.78 3.00 Female No Thur Dinner 2
Head and Tail
head(N): 是查前面 N 筆資料
print(tips.head(10))
output:
1 2 3 4 5 6 7 8 9 10 11
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 5 25.29 4.71 Male No Sun Dinner 4 6 8.77 2.00 Male No Sun Dinner 2 7 26.88 3.12 Male No Sun Dinner 4 8 15.04 1.96 Male No Sun Dinner 2 9 14.78 3.23 Male No Sun Dinner 2
tail(N): 是查最後 N 筆資料
print(tips.tail(10))
output
1 2 3 4 5 6 7 8 9 10 11
total_bill tip sex smoker day time size 234 15.53 3.00 Male Yes Sat Dinner 2 235 10.07 1.25 Male No Sat Dinner 2 236 12.60 1.00 Male Yes Sat Dinner 2 237 32.83 1.17 Male Yes Sat Dinner 2 238 35.83 4.67 Female No Sat Dinner 3 239 29.03 5.92 Male No Sat Dinner 3 240 27.18 2.00 Female Yes Sat Dinner 2 241 22.67 2.00 Male Yes Sat Dinner 2 242 17.82 1.75 Male No Sat Dinner 2 243 18.78 3.00 Female No Thur Dinner 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 .. ... ... ... ... ... ... ... 235 10.07 1.25 Male No Sat Dinner 2 238 35.83 4.67 Female No Sat Dinner 3 239 29.03 5.92 Male No Sat Dinner 3 242 17.82 1.75 Male No Sat Dinner 2 243 18.78 3.00 Female No Thur Dinner 2
total_bill tip sex smoker day time size 56 38.01 3.00 Male Yes Sat Dinner 4 58 11.24 1.76 Male Yes Sat Dinner 2 60 20.29 3.21 Male Yes Sat Dinner 2 61 13.81 2.00 Male Yes Sat Dinner 2 62 11.02 1.98 Male Yes Sat Dinner 2 63 18.29 3.76 Male Yes Sat Dinner 4 69 15.01 2.09 Male Yes Sat Dinner 2 76 17.92 3.08 Male Yes Sat Dinner 2 80 19.44 3.00 Male Yes Thur Lunch 2 83 32.68 5.00 Male Yes Thur Lunch 2 90 28.97 3.00 Male Yes Fri Dinner 2 95 40.17 4.73 Male Yes Fri Dinner 4
sex tip 0 Female 1.01 1 Male 1.66 2 Male 3.50 3 Male 3.31 4 Female 3.61 .. ... ... 239 Male 5.92 240 Female 2.00 241 Male 2.00 242 Male 1.75 243 Female 3.00
total_bill tip sex smoker day time size 11 35.26 5.00 Female No Sun Dinner 4 44 30.40 5.60 Male No Sun Dinner 4 46 22.23 5.00 Male No Sun Dinner 2 47 32.40 6.00 Male No Sun Dinner 4 52 34.81 5.20 Female No Sun Dinner 4 116 29.93 5.07 Male No Sun Dinner 4 155 29.85 5.14 Female No Sun Dinner 5 156 48.17 5.00 Male No Sun Dinner 6 172 7.25 5.15 Male Yes Sun Dinner 2 181 23.33 5.65 Male Yes Sun Dinner 2 183 23.17 6.50 Male Yes Sun Dinner 4 185 20.69 5.00 Male No Sun Dinner 5
survived pclass sex age sibsp parch fare embarked class \ 0 0 3 male 22.0 1 0 7.2500 S Third 1 1 1 female 38.0 1 0 71.2833 C First 2 1 3 female 26.0 0 0 7.9250 S Third 3 1 1 female 35.0 1 0 53.1000 S First 4 0 3 male 35.0 0 0 8.0500 S Third .. ... ... ... ... ... ... ... ... ... 886 0 2 male 27.0 0 0 13.0000 S Second 887 1 1 female 19.0 0 0 30.0000 S First 888 0 3 female NaN 1 2 23.4500 S Third 889 1 1 male 26.0 0 0 30.0000 C First 890 0 3 male 32.0 0 0 7.7500 Q Third
who adult_male deck embark_town alive alone 0 man True NaN Southampton no False 1 woman False C Cherbourg yes False 2 woman False NaN Southampton yes True 3 woman False C Southampton yes False 4 man True NaN Southampton no True .. ... ... ... ... ... ... 886 man True NaN Southampton no True 887 woman False B Southampton yes True 888 woman False NaN Southampton no False 889 man True C Cherbourg yes True 890 man True NaN Queenstown no True