In the code bellow each 'Person' has a corresponding 'Sales' value , but when I execute print(compData.max()) 'Vanessa' gets the value of '340' which in the initial 'df' belongs to 'Amy'
import numpy as np
import pandas as pd
data = {'Company':['GOOG','GOOG','MSFT','MSFT','FB','FB'],
       'Person':['Sam','Charlie','Amy','Vanessa','Carl','Sarah'],
       'Sales':[200,120,340,124,243,350]}
df = pd.DataFrame(data)
compData = df.groupby('Company')
print(df)
print(compData.max())
print(df.loc[3])
Here is the output :
  Company   Person  Sales
0    GOOG      Sam    200
1    GOOG  Charlie    120
2    MSFT      Amy    340
3    MSFT  Vanessa    124
4      FB     Carl    243
5      FB    Sarah    350
          Person  Sales
Company                
FB         Sarah    350
GOOG         Sam    200
MSFT     Vanessa    340
Company       MSFT
Person     Vanessa
Sales          124
Also when I execute print(df.loc[3]) 'Vanessa' gets the right value
 
     
    