I'm trying to return a tuple of the index (the people names below) and the max value for the '%' column below. When I create a Dataframe and try
df['%'].max()
Pandas always returns just the value an not the index. However, I want to create a tuple from the key value pair of the index and max value in the '%' column. I'm sure this is a newbie question, thank you for helping me!
Here's some sample data:
Points_Scored Possible_Points % Favoriate Food
Jan 60 200 0.3 Pudding
Jane 87 200 0.435 Pizza
Bob 54 200 0.27 Salad
Bubba 42 200 0.21 Salsa
Jack 98 200 0.49 Avacodo
John 45 200 0.225 Bacon
Mike 63 200 0.315 Tacos
Victor 8 200 0.04 Lettuce
Here is one way:
df['%'].idxmax(), df['%'].max()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With