pandas 查找单个列的最大值/最小值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/47006617/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Finding max /min value of individual columns
提问by UjwalPathak
I am a beginner to Data Analysis using Python and stuck on the following:
我是使用 Python 进行数据分析的初学者,并坚持以下几点:
I want to find maximum value from individual columns (pandas.dataframe) using Broadcasting /Vectorization methodology.
我想使用广播/矢量化方法从单个列 (pandas.dataframe) 中找到最大值。
A snapshot of my data Frame is as follows:enter image description here
我的数据框的快照如下:在此处输入图像描述
回答by u8820020
you can use pandas.DataFrame built-in function max and min to find it
您可以使用 pandas.DataFrame 内置函数 max 和 min 来查找它
example
例子
df = pandas.DataFrame(randn(4,4))
df.max(axis=0) # will return max value of each column
df.max(axis=0)['AAL'] # column AAL's max
df.max(axis=1) # will return max value of each row
or another way just find that column you want and call max
或另一种方式只需找到您想要的列并调用 max
df = pandas.DataFrame(randn(4,4))
df['AAL'].max()
df['AAP'].min()
min is the same
分钟是一样的