一、数据来源
数据来源于阿里天池,源数据大概有1亿行记录,因为硬件原因,所以只截取了2017年11月25日到2017年12月4日的数据进行分析。
二、数据结构
列名称 | 说明 |
user_id | 用户id,整数类型,序列化后的用户id |
item_id | 商品id,整数类型,序列化后的商品id |
category_id | 商品类目id,整数类型,序列化后的商品所属类目id |
hehavior_type | 行为类型,字符串,枚举类型,包括('pv', 'buy', 'cart', 'fav') |
date | 时间戳,行为发生的时间戳 |
行为类型 | 说明 |
---|---|
pv | 商品详情页pv,等价于点击 |
buy | 商品购买 |
cart | 将商品加入购物车 |
fav | 收藏商品 |
三、数据清洗
1、 原始数据中,时间戳是一个10位数的数字,需要将其变更为日期
update userbe set date=FROM_UNIXTIME(date,'%Y-%m-%d %H:%i:%s')
2、经过数据检查,均没有重复值、缺失值和异常值,直接进行下述数据分析。
3、查看数据量
四、数据分析
1、pv/uv分析
select riqi,count(behavior_type) pv, count(distinct user_id) uv,count(behavior_type)/count(distinct user_id) '人均页面访问数' from users where behavior_type='pv' group by riqi order by riqi
11月25日到12月4日,正处于双十一结束、双十二预热期。从pv和uv来看,12月2日有明显的增长,分析原因可能是因为改日处于双十二预热期。
2、用户行为分析
create table usersbe as(
select user_id,sum(case when behavior_type='pv' then 1 else 0 end) as '浏览次数',
sum(case when behavior_type='fav' then 1 else 0 end) as '收藏次数',
sum(case when behavior_type='cart' then 1 else 0 end) as '加购次数',
sum(case when behavior_type='buy' then 1 else 0 end) as '购买次数' from users group by user_id)
select count(case when `浏览次数`>0 and `收藏次数`=0 and `加购次数`=0 and `购买次数`=0 then user_id else null end) '只浏览',
count(case when `浏览次数`>0 and `收藏次数`>0 and `加购次数`=0 and `购买次数`=0 then user_id else null end) '浏览收藏未购买',
count(case when `浏览次数`>0 and `收藏次数`=0 and `加购次数`>0 and `购买次数`=0 then user_id else null end) '浏览加购未购买',
count(case when `浏览次数`>0 and `收藏次数`>0 and `加购次数`>0 and `购买次数`=0 then user_id else null end) '浏览收藏加购未购买',
count(case when `浏览次数`>0 and `收藏次数`=0 and `加购次数`=0 and `购买次数`>0 then user_id else null end) '浏览购买',
count(case when `浏览次数`>0 and `收藏次数`>0 and `加购次数`=0 and `购买次数`>0 then user_id else null end) '浏览收藏购买',
count(case when `浏览次数`>0 and `收藏次数`=0 and `加购次数`>0 and `购买次数`>0 then user_id else null end) '浏览加购购买',
count(case when `浏览次数`>0 and `收藏次数`>0 and `加购次数`>0 and `购买次数`>0 then user_id else null end) '浏览收藏加购购买',
count(case when `浏览次数`=0 and `购买次数`=0 then user_id else null end) '未浏览未购买',
count(case when `浏览次数`=0 and `购买次数`>0 then user_id else null end) '未浏览购买'
from usersbe
浏览加购购买占比最大且为32.82%,对比浏览收藏购买占比,说明用户偏向于加入购物车后购买。
用户浏览、收藏、加购行为主要在21点、22点,购买行为在9点-15点以及21-22点。
这个比较符合人的作息规律,白天忙于工作,晚上购物。
2、转化率
收藏/加购的转化率为9.33%,转化率比较低,可能由于商品不满足需求或者商品详情页不友好等问题造成,可以对其中的原因进行进一步的分析挖掘。
4、用户商品偏好
销量top10,商品类目