Pandas find row where values for column is maximum
Find row where values for column is maximum:
import pandas as pd df = pd.DataFrame([[10, 20, 30, 40], [7, 14, 21, 28], [55, 15, 8, 12]], columns=['Apple', 'Orange', 'Banana', 'Pear'], index=['Basket1', 'Basket2', 'Basket3']) print(df.ix[df['Apple'].idxmax()])
C:\pandas>python example.py Apple 55 Orange 15 Banana 8 Pear 12 Name: Basket3, dtype: int64 C:\pandas>
2018-10-17T06:08:04+05:30
2018-10-17T06:08:04+05:30
Amit Arora
Amit Arora
Python Programming Tutorial
Python
Practical Solution