I am newbie to this python.Consider i have 2 columns in a dataframe as follows:
A B
2 6
3 7
4 8
Now the maximum in column B is 8 and i need the value in column A for that, here its 4. Please help to solve this. Thanks in advance.
I am newbie to this python.Consider i have 2 columns in a dataframe as follows:
A B
2 6
3 7
4 8
Now the maximum in column B is 8 and i need the value in column A for that, here its 4. Please help to solve this. Thanks in advance.
Use idxmax() to get the index of max value, and then reference the index value in column A
In [7]: df.ix[df['B'].idxmax(), 'A']
Out[7]: 4
Where
In [8]: df['B'].idxmax()
Out[8]: 2