美文网首页
自行车业务分析 3.1 3.2

自行车业务分析 3.1 3.2

作者: 人间桑 | 来源:发表于2020-06-10 16:21 被阅读0次

三、2019年11月自行车产品销售表现

3.1、数据源 dw_customer_order

#查看数据源

gather_customer_order.head(3)

3.2、细分市场销量表现

作业 3.2.1、gather_customer_order表利用groupby聚合月份,求每个月自行车的销售数量,赋值给变量gather_customer_order_group_month

#求每个月自行车累计销售数量

gather_customer_order_group_month = gather_customer_order.groupby('create_year_month').agg({'order_num':'sum'},axis=0).reset_index()

gather_customer_order_group_month.head()

作业 3.2.2、利用pd.merge模块合并自行车销售信息表(gather_customer_order)+自行车每月累计销售数量表(gather_customer_order_group_month)赋值变量给order_num_proportion

order_num_proportion = pd.merge(gather_customer_order,gather_customer_order_group_month,on='create_year_month',how='left')

作业 3.2.3、计算自行车销量/自行车每月销量占比,计算结果形成新的列'order_proportion'

order_num_proportion['order_proportion']=order_num_proportion['order_num_x']/order_num_proportion['order_num_y']

作业 3.2.4、重命名自行车每月销售量order_num_y为sum_month_order

#重命名sum_month_order:自行车每月销售量

order_num_proportion = order_num_proportion.rename(columns={'order_num_y':'sum_month_order'})

相关文章

网友评论

      本文标题:自行车业务分析 3.1 3.2

      本文链接:https://www.haomeiwen.com/subject/ausptktx.html