6

I already sorted the data and the dataframe now is like this:

              Tr Srate(V/ns)mean  Tf Srate(V/ns)mean
CPULabel                                            
100HiBW_Fast                3.16                3.09
100LoBW_Fast                3.16                3.09
BP100_Fast                  3.16                3.06

My dataframe is slew_rate_max. I tried to use:

slew_rate_max.max()

I expected the result to be 3.16. However, I got the max values of both columns individually.

Tr Srate(V/ns)mean    3.16
Tf Srate(V/ns)mean    3.09
dtype: float64

How to get the max value of the whole dataframe not of each column?

1 Answer 1

7

Try:

slew_rate_max.max().max()

slew_rate_max.max() returns a series with the max of each column, then taking the max again of that series will give you the max of the entire dataframe.

or

slew_rate_max.values.max()

slew_rate_max.values converts the dataframe to a np.ndarray then using numpy.ndarray.max which as an argument axis that the default is None, this gives the max of the entire ndarray.

Sign up to request clarification or add additional context in comments.

2 Comments

which one would be faster among these options? doesn't it even matter when there are a million rows?
@Freak I am pretty sure that slew_rate_max.to_numpy().max() is faster.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.