定性数据分布分析(饼图,条形图)

该博客通过Python的数据分析,展示了如何利用pandas库读取Excel数据,并使用matplotlib绘制饼图和条形图来展示不同菜品在某段时间内的销售量分布情况。饼图直观地显示了各菜品的销售比例,而条形图则按销量大小排列了各菜品。这种方法有助于理解菜品销售的热门趋势。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

定性数据

对于定性数据,根据变量的类型来分组,绘制饼状图或条形图来描述定性数据的分布

不同菜品在某段时间的销售量分布情况
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = 'SimHei'


data = pd.read_excel("catering_dish_profit.xls")

#饼图
x = data['盈利']
labels = data['菜品名']
plt.figure(figsize=(8,6))
plt.pie(x,labels = labels)
plt.title("菜品销售量分布图")
plt.axis('equal')
plt.show()

#条形图
x = data['菜品名']
y = data['盈利']
plt.figure(figsize=(8,6))
plt.bar(x,y)
plt.xlabel('菜品')
plt.ylabel('销量')
plt.title('菜品销量分布图')
plt.show()

在这里插入图片描述
在这里插入图片描述

分享产生价值! A valuable new edition of a standard reference "A 'must-have' book for anyone expecting to do research and/or applications in categorical data analysis." –Statistics in Medicine on Categorical Data Analysis, First Edition The use of statistical methods for categorical data has increased dramatically, particularly for applications in the biomedical and social sciences. Responding to new developments in the field as well as to the needs of a new generation of professionals and students, this new edition of the classic Categorical Data Analysis offers a comprehensive introduction to the most important methods for categorical data analysis. Designed for statisticians and biostatisticians as well as scientists and graduate students practicing statistics, Categorical Data Analysis, Second Edition summarizes the latest methods for univariate and correlated multivariate categorical responses. Readers will find a unified generalized linear models approach that connects logistic regression and Poisson and negative binomial regression for discrete data with normal regression for continuous data. Adding to the value in the new edition is coverage of: Three new chapters on methods for repeated measurement and other forms of clustered categorical data, including marginal models and associated generalized estimating equations (GEE) methods, and mixed models with random effects Stronger emphasis on logistic regression modeling of binary and multicategory data An appendix showing the use of SAS for conducting nearly all analyses in the book Prescriptions for how ordinal variables should be treated differently than nominal variables Discussion of exact small-sample procedures More than 100 analyses of real data sets to illustrate application of the methods, and more than 600 exercises An Instructor's Manual presenting detailed solutions to all the problems in the book is available from the Wiley editorial department.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值