1

I have this

data

How do i find max value of MMAX, but the vendor must be an "amdahl"?

Should I make a new data manually?
Use Python, pls..

MarianD
  • 13,096
  • 12
  • 42
  • 54

3 Answers3

2

Try using groupby and max:

print(df.groupby('Vendor')['MMAX'].max()['amdahl'])
U13-Forward
  • 69,221
  • 14
  • 89
  • 114
2

You can also use loc:

print(max(df.loc[df['Vendor'] == 'amdahl'].MMAX))
Ishan
  • 859
  • 5
  • 9
0
df[df.Vendor == "amdahl"].MMAX.max()

The explanation:

  • df[df.Vendor == "amdahl"] selects only rows which fulfill the condition in brackets, then
  • .MMAX returns only the NMAX column (as a series), and finally
  • .max() method returns the maximum of that series values.

Note:

A more verbose version of the same approach is using the ["colname"] notations (instead of the abbreviated ones .colname):

df[df["Vendor"] == "amdahl"]["MMAX"].max()
MarianD
  • 13,096
  • 12
  • 42
  • 54