数据集下载地址:
https://www.kaggle.com/jessemostipak/hotel-booking-demand
数据集为葡萄牙的一家城市酒店和一家度假酒店酒店预订数据。数据的时间跨度从2015年7月1日至2017年8月31日。
该数据集同时包含城市酒店和度假酒店的预订信息,包括预订时间、停留时间,成人/儿童/婴儿人数以及可用停车位数量等信息。
适用场景:社会科学、旅行、酒店、用户行为,不具有明显的行业标识,可进行常规用户行为分析。
数据量:32列共12W数据量。
可以定义的问题:
1)基本情况:城市酒店和假日酒店预订需求和入住率比较;
2)用户行为:提前预订时长、入住时长、预订间隔、餐食预订情况;
3)一年中最佳预订酒店时间;
4)利用Logistic预测酒店预订。
部分列含义说明:
hotel : 酒店名称, city hotel 66% , Reort hotel 34%
is_canceled : 01取值;1:取消预订,0:未取消预订
lead_time : 预订输入日期到到达日期之间经过的天数
arrival_date_year : 入住年份
arrival_date_month:入住月份
arrival_date_week_number
arrival_date_day_of_month
stays_in_weekend_nights:入住或预订入住酒店的周末住宿数(周六或周日)
stays_in_week_nights:工作日停留天数
adults: 成人人数
children: 儿童人数
babies
meal:预订的膳食类型
country :国家
market_segment:细分市场名称
distribution_channel:预订方式:旅行社,直接预定,公司统一预订
is_repeated_guest:回头客?1(是):0(否)
previous_cancellations:客户在当前预订之前取消的先前预订数
previous_bookings_not_canceled
reserved_room_type
assigned_room_type
booking_changes
deposit_type:说明客户是否为保证预订而存款。
agent:代理商
company
days_in_waiting_list :在与客户确认预订之前,预订在等候列表中的天数
customer_type
adr :通过将所有住宿交易的总和除以住宿日来定义的每日平均费率(就是每天的平均花费)
required_car_parking_spaces: 客户要求的停车位数量
total_of_special_requests:客户提出的特殊要求数量(例如双床或高楼层)
reservation_status:预订最后状态,已取消 (cancel) 客户取消预订;退房(check-out)
reservation_status_date
文章目录
数据挖掘步骤
1、确定要发现的目标
2、数据采集
3、数据探索
4、数据预处理
5、数据挖掘(模型选择)
6、模式评估
1、确定目标
预测用户是否会取消预订
2、数据探索
这一步主要包括数据特征的基本统计描述、数据特征间的相似/相异性等。可以采用可视化将数据特征展示出来。
#导入数据集
import pandas as pd
hotel_data = pd.read_csv('./hotel_bookings.csv')
hotel_data.shape
(119390, 32)
#查看前5行
hotel_data.head()
变量分析:哪些是输出变量?哪些是输入
这里显然 is_canceled是作为分类结果
hotel_data.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 119390 entries, 0 to 119389
Data columns (total 32 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 hotel 119390 non-null object
1 is_canceled 119390 non-null int64
2 lead_time 119390 non-null int64
3 arrival_date_year 119390 non-null int64
4 arrival_date_month 119390 non-null object
5 arrival_date_week_number 119390 non-null int64
6 arrival_date_day_of_month 119390 non-null int64
7 stays_in_weekend_nights 119390 non-null int64
8 stays_in_week_nights 119390 non-null int64
9 adults 119390 non-null int64
10 children 119386 non-null float64
11 babies 119390 non-null int64
12 meal 119390 non-null object
13 country 118902 non-null object
14 market_segment 119390 non-null object
15 distribution_channel 119390 non-null object
16 is_repeated_guest 119390 non-