
本节选用的是 Python 的第三方库 seaborn 自带的数据集,该小费数据集为餐饮行业收集的数据,其中 total_bill 为消费总金额、tip 为小费金额、sex 为顾客性别、smoker 为顾客是否吸烟、day 为消费的星期、time 为聚餐的时间段、size 为聚餐人数。
import numpy as np
from pandas import Series,DataFrame
import pandas as pd
import seaborn as sns #导入seaborn库
tips=sns.load_dataset('tips') #seaborn库自带的数据集
tips.head()

tips.shape #数据集的维度
(244,7)
共有 244 条数据,7 列。
tips.describe() #描述统计