Pandas中describe()函数的具体使用
作者:林几瑕 时间:2021-03-22 14:32:12
先附上官方文档:
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.describe.html
describe()有三个参数:
DataFrame.describe(percentiles=None, include=None, exclude=None)
# return:Series or DataFrame. Summary statistics of the Series or Dataframe provided.
几个要点:
1.include=‘all’,代表对所有列进行统计,如果不加这个参数,则只对数值列进行统计
datafile.describe(include='all')
没加参数的少了height列(height为离散型变量,其余为数值型):
加了参数include=‘all’,出现height变量:
2.统计变量说明:
count:数量统计,此列共有多少有效值
unipue:不同的值有多少个
std:标准差
min:最小值
25%:四分之一分位数
50%:二分之一分位数
75%:四分之三分位数
max:最大值
mean:均值
3.仅仅显示离散型变量:include=[‘O’]
df.describe(include=['O'])
只显示了height列:
4.第一个percentiles,这个参数可以设定数值型特征的统计量,默认[.25, .5, .75],返回25%,50%,75%时候的数据,可修改参数,**如:
df.describe(percentiles=[.10, .75, .8])
5.第三个参数可以指定不选择哪些列。
例如
df.describe(exclude=['O'])
height列没有了:
来源:https://blog.csdn.net/weixin_43582443/article/details/111131400
标签:Pandas,describe
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
web开发以HTML为中心
2008-02-13 08:14:00
![](https://img.aspxhome.com/file/UploadPic/20082/13/200821382345331s.png)
python热力图实现的完整实例
2023-03-02 17:10:35
![](https://img.aspxhome.com/file/2023/2/92352_0s.png)
解决jupyter加载文件失败的问题
2022-07-21 19:17:05
![](https://img.aspxhome.com/file/2023/2/85062_0s.jpg)
基于Python实现自制拼图小游戏
2021-12-01 03:25:01
![](https://img.aspxhome.com/file/2023/9/92099_0s.gif)
[译]图片优化 第五章:AlphaImageLoader
2010-08-29 18:39:00
![](https://img.aspxhome.com/file/UploadPic/20108/29/png-transparency-64s.png)
Python3标准库总结
2022-10-22 13:36:47
Python学习之Django的管理界面代码示例
2022-07-16 21:29:07
![](https://img.aspxhome.com/file/2023/2/98992_0s.png)
网页标准化-CSS命名规划整理
2007-12-10 18:13:00
.net 上传文件前所未有的简单
2023-07-17 23:20:04
python列表添加元素append(),extend(),insert(),+list的区别及说明
2022-12-11 08:48:35
![](https://img.aspxhome.com/file/2023/1/95161_0s.png)
laravel yajra插件 datatable的使用详解
2023-11-18 20:05:06
![](https://img.aspxhome.com/file/2023/6/88296_0s.png)
Python keras.metrics源代码分析
2023-10-28 20:58:14
python的内存管理和垃圾回收机制详解
2021-07-30 14:18:05
![](https://img.aspxhome.com/file/2023/5/78845_0s.png)
Python算法应用实战之栈详解
2022-08-22 21:56:10
![](https://img.aspxhome.com/file/2023/7/69547_0s.png)
使用Python操作Elasticsearch数据索引的教程
2021-03-04 22:51:28
![](https://img.aspxhome.com/file/2023/9/93019_0s.jpg)
Python变量名详细规则详细变量值介绍
2021-08-05 07:51:57
![](https://img.aspxhome.com/file/2023/9/77589_0s.png)
python 层次聚类算法图文示例
2023-09-25 05:57:46
![](https://img.aspxhome.com/file/2023/6/96916_0s.png)
三达不溜:www
2009-03-28 11:44:00
![](https://img.aspxhome.com/file/UploadPic/20093/28/www-43s.png)
python 算法 排序实现快速排序
2022-09-04 03:20:17
border:none;与border:0;的区别
2009-11-27 19:04:00
![](https://img.aspxhome.com/file/UploadPic/200911/27/01-22s.png)