python数据统计_python – 计算数据框中列的汇总统计信息

describe可以给你所有你想要的东西,否则你可以使用groupby执行聚合,并传递一个agg函数列表:

http://pandas.pydata.org/pandas-docs/stable/groupby.html#applying-multiple-functions-at-once

In [43]:

df.describe()

Out[43]:

shopper_num is_martian number_of_items count_pineapples

count 14.0000 14 14.000000 14

mean 7.5000 0 3.357143 0

std 4.1833 0 6.452276 0

min 1.0000 False 0.000000 0

25% 4.2500 0 0.000000 0

50% 7.5000 0 0.000000 0

75% 10.7500 0 3.500000 0

max 14.0000 False 22.000000 0

[8 rows x 4 columns]

请注意,一些列不能被归纳为没有逻辑的方法来总结它们,例如包含字符串数据的列

如果您愿意,您可以转移结果:

In [47]:

df.describe().transpose()

Out[47]:

count mean std min 25% 50% 75% max

shopper_num 14 7.5 4.1833 1 4.25 7.5 10.75 14

is_martian 14 0 0 False 0 0 0 False

number_of_items 14 3.357143 6.452276 0 0 0 3.5 22

count_pineapples 14 0 0 0 0 0 0 0

[4 rows x 8 columns]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值