Python笔记:2020年4月份各部门每日特采单品

梦想的初衷 提交于 2020-05-04 09:23:08
各位领导、同事:
        大家好!
 
        以下是2020年4月份华南采购中心各部门“每日特采单品”明细及其汇总信息。
        请各位部门与品类负责人多多关注及跟进。
        详情请参阅附件
        谢谢!
 由以下两图观察分析可见,4月5日打折入库的单品个数最多,为10个;4月6日打折入库的单品个数最少,为0个。4月份平均每日约有3.03个单品被打折入库。
from pyecharts import options as opts
from pyecharts.charts import Map, Bar, Grid
from pyecharts.globals import ChartType, ThemeType
import random
# 添加
from pyecharts.charts import Line

date = ["4月1日","4月2日","4月3日","4月4日","4月5日","4月6日","4月7日","4月8日","4月9日","4月10日","4月11日","4月12日","4月13日","4月14日",
       "4月15日","4月16日","4月17日","4月18日","4月19日","4月20日","4月21日","4月22日","4月23日","4月24日","4月25日","4月26日","4月27日",
        "4月28日","4月29日","4月30日"]
data = [2,7,1,1,10,0,5,4,6,2,6,2,2,4,1,3,3,2,4,2,2,4,1,1,5,1,3,2,3,2]
bar = (Bar()
       .add_xaxis(date)
       .add_yaxis("每日打折入库单品个数", data)
       .set_series_opts(label_opts=opts.LabelOpts(is_show=False))
       .set_global_opts(
            title_opts=opts.TitleOpts(title="每日打折入库单品个数")
        )
      )

line = (Line()
       .add_xaxis(date)
       .add_yaxis("每日打折入库单品个数", data, 
                  markline_opts=opts.MarkLineOpts(data=[opts.MarkLineItem(type_="average")]))
       .set_global_opts(title_opts=opts.TitleOpts(title="每天打折的数目变化", pos_top="48%"))
      )

grid = (
        Grid()
        .add(bar, grid_opts=opts.GridOpts(pos_bottom="60%"))
        .add(line, grid_opts=opts.GridOpts(pos_top="60%"))
    )

grid.render_notebook()

# 客单
from pyecharts.charts import Line
from pyecharts import options as opts


date2 = ["4月1日","4月2日","4月3日","4月4日","4月5日","4月6日","4月7日","4月8日","4月9日","4月10日","4月11日","4月12日","4月13日","4月14日",
       "4月15日","4月16日","4月17日","4月18日","4月19日","4月20日","4月21日","4月22日","4月23日","4月24日","4月25日","4月26日","4月27日",
        "4月28日","4月29日","4月30日"]
data2 = [2,7,1,1,10,0,5,4,6,2,6,2,2,4,1,3,3,2,4,2,2,4,1,1,5,1,3,2,3,2]

line = (Line()
       .add_xaxis(date2)
       .add_yaxis("4月份每日打折验收单品", data2, 
                  is_smooth=True, 
                  markpoint_opts=opts.MarkPointOpts(data=[opts.MarkPointItem(name="最大值", 
                                                                             coord=[date2[4], data2[4]], value=data2[4])]))
         
        
       .set_global_opts(title_opts=opts.TitleOpts(title="每日变化趋势", subtitle="华南采购中心"))
      )

line.render_notebook()

 4月份打折入库的单品中,按部门划分,蔬菜最多,其次是水产、水果与综合,且各部门的占比分别为:39.56%,31.87%,18.68%,9.89%.
 
from pyecharts.charts import Funnel
from pyecharts import options as opts

# 示例数据
cate1 = ["蔬菜","水产","水果","综合"]
data1 = [36,29,17,9]
"""
漏斗图示例:
1. sort_控制排序,默认降序;
2. 标签显示位置
"""
funnel = (Funnel()
          .add("打折单品个数", [list(z) for z in zip(cate1, data1)], 
               sort_='ascending',
               label_opts=opts.LabelOpts(position="inside"))
          .set_global_opts(title_opts=opts.TitleOpts(title="各部门打折单品比例", subtitle="2020年4月份"))
         )

funnel.render_notebook()

from pyecharts.charts import Pie
from pyecharts import options as opts

# 示例数据
cate = ["蔬菜","水产","水果","综合"]
data = [36,29,17,9]
pie = (Pie()
       .add('', [list(z) for z in zip(cate, data)],
            radius=["30%", "75%"],
            rosetype="radius")
       .set_global_opts(title_opts=opts.TitleOpts(title="各部门打折单品占比", subtitle="2020年4月份"))
       .set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {d}%"))
      )

pie.render_notebook()

 “进口青提”被打折的次数最多,其次是“乳山鲜生蚝(盒)”,数量分别为8个与6个;
        每日打折入库单品个数的频次区间为[0,8],基本上每天都有1~2个单品被打折入库;众数为2,中位数为3.03,最大值为8,最小值为0,极差为8.
from pyecharts.charts import Bar
from pyecharts import options as opts

# 示例数据
goods = ["进口青提","乳山鲜生蚝(盒)","海瓜子","莲藕","吊筒(盒)","红番薯","大白菜","八爪鱼仔","云南鲜板栗",
         "荔浦芋头","水豆腐","红糖馒头(4个装)","本地红萝卜","沃柑","进口香蕉","甜玉米","多春鱼","基围虾",
         "山东水晶富士","菜心苗","海鲈鱼","进口加力果","鸡胸肉","沙白","小京包","黄牛牛肉","冬瓜","禾花鱼",
         "包生菜","鲟龙鱼","番薯苗","蒜心","水粉","土豆","澄海酸菜","苦瓜","东方蜜瓜","桂花鱼","黄心白",
         "白蘑菇(盒)","青口贝","娃娃菜(包)","谷物鲜鸡蛋","红洋葱"]
data3 = [8,6,4,4,4,4,4,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
bar = (Bar()
       .add_xaxis(goods)
       .add_yaxis("各单品打折次数", data3)
       .set_global_opts(title_opts=opts.TitleOpts(title="各单品打折次数", subtitle="2020年4月份"))
       .set_series_opts(label_opts=opts.LabelOpts(is_show=False))
       .reversal_axis()
      )

bar.render_notebook()
from pyecharts.charts import Bar
from pyecharts import options as opts

# 示例数据
goods1 = ["禾花鱼","包生菜","鲟龙鱼","番薯苗","蒜心","水粉","土豆","澄海酸菜","苦瓜","东方蜜瓜","桂花鱼","黄心白",
          "白蘑菇(盒)","青口贝","娃娃菜(包)","谷物鲜鸡蛋","红洋葱","八爪鱼仔","云南鲜板栗","荔浦芋头","水豆腐",
          "红糖馒头(4个装)","本地红萝卜","沃柑","进口香蕉","甜玉米","多春鱼","基围虾","山东水晶富士","菜心苗",
          "海鲈鱼","进口加力果","鸡胸肉","沙白","小京包","黄牛牛肉","冬瓜","海瓜子","莲藕","吊筒(盒)","红番薯",
          "大白菜","乳山鲜生蚝(盒)","进口青提"]
data4 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,4,4,4,4,4,6,8]
bar = (Bar()
       .add_xaxis(goods1)
       .add_yaxis("各单品打折次数", data4)
       .set_global_opts(title_opts=opts.TitleOpts(title="各单品打折次数", subtitle="2020年4月份"))
       .set_series_opts(label_opts=opts.LabelOpts(is_show=False))
       .reversal_axis()
      )

bar.render_notebook()

  【4月份各部门每日打折入库单品明细】
 
 
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!