从DF中为 pandas 中的特定列提取最大值,最小值或标准差 [英] Extracting the max, min or std from a DF for a particular column in pandas

查看:379
本文介绍了从DF中为 pandas 中的特定列提取最大值,最小值或标准差的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有X1,Y1,Z3列的df. df.describe显示每列的统计信息

I have a df with columns X1, Y1, Z3. df.describe shows the stats for each column

我想提取Z3列的min,max和std. df[df.z3].idxmax()似乎不起作用

I would like to extract the min, max and std for say column Z3. df[df.z3].idxmax() doesn't seem to work

推荐答案

熊猫0.20.0中的新功能, pd.DataFrame.agg

df.agg(['min', 'max', 'std'])

           X1        Y1        Z3
min  0.074689  0.032109  0.074912
max  0.833935  0.981217  0.840831
std  0.252231  0.315192  0.294872

这篇关于从DF中为 pandas 中的特定列提取最大值,最小值或标准差的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆