帕累托法则
在任何特定群体中,重要的因子通常只占少数,而不重要的因子则占多数,因此只要能控制具有重要性的少数因子即能控制全局。
数据展示

代码实现
#-*- coding: utf-8 -*-
#菜品盈利数据 帕累托图
from __future__ import print_function
import pandas as pd
#初始化参数
dish_profit = 'dish.xls' #餐饮菜品盈利数据
data = pd.read_excel(dish_profit, index_col = u'菜品ID')
data = data[u'盈利'].copy()
data = data.sort_values(ascending = False)#逆序排序
import matplotlib.pyplot as plt #导入图像库
plt.rcParams['font.sans-serif'] = ['SimHei'] #用来正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False #用来正常显示负号
plt.figure()
data.plot(kind='bar')
plt.ylabel(u'盈利(元)')
p = 1.0*data.cumsum()/data.sum()
p.plot(color = 'r', secondary_y = True, style = '-o',linewidth = 2)
plt.annotate(format(p[6], '.4%'), xy = (6, p[6]), xytext=(6*0.9, p[6]*0.9), arrowprops=dict(arrowstyle="->", connectionstyle="arc3,rad=.2")) #添加注释,即85%处的标记。这里包括了指定箭头样式。
plt.ylabel(u'盈利(比例)')
plt.show()
帕累托图展示
本文通过Python探讨帕累托法则,展示了如何利用代码进行数据展示和创建帕累托图,强调在数据分析中控制关键少数因素的重要性。
贡献度分析——帕累托法则&spm=1001.2101.3001.5002&articleId=107190438&d=1&t=3&u=c1a8223b9451420982cd05a3dcf0234b)
870

被折叠的 条评论
为什么被折叠?



