Pandas DataFrame Get value from column

Maybe I have a dataframe as shown below:

Idx ABC 0 1 2 3 1 3 4 5 2 2 3 8 

The maximum value of column B of the data data is 4, and I could get the index from df["B"].argmax() , which is 1.

Now the problem is, how do I get the exact maximum value of the dataframe B column?

Thanks!

+4
source share
1 answer
 In [6]: df Out[6]: ABC Idx 0 1 2 3 1 3 4 5 2 2 3 8 In [7]: df.max() Out[7]: A 3 B 4 C 8 dtype: int64 In [10]: df['B'].max() Out[10]: 4 In [8]: df.idxmax() Out[8]: A 1 B 1 C 2 dtype: int64 
+4
source

All Articles