Answered step by step
Verified Expert Solution
Question
1 Approved Answer
How to sort index and column data by ascending order in python So far I have the percentages sorted, but now I need to fix
How to sort index and column data by ascending order in python
So far I have the percentages sorted, but now I need to fix the indexes, need to reset the index of df so that the highest sugarpercent candy is index 0.
In [222]: # YOUR CODE HERE df = df.sort_values('sugarpercent', ascending=False) print(df) sugarpercent chocolate winpercent pricepercent 0.988 1 72.887901 0.651 0.965 1 64.353340 0.860 0.941 0 55.103695 0.220 0.941 0 63.085140 0.220 0.906 0 52.341465 0.511 0 0.069 0.069 0.046 0.046 0.034 52.825947 59.863998 39.141056 24.524988 81.866257 0.116 0.116 0.104 0.325 0.279 0 1 1 competitorname fruity hard multicandy_pack bar 54 Reeses stuffed with pieces Milky Way Simply Caramel Skittles wildberry Skittles original 10 Air Heads 1 0 1 0 Sour Patch Tricksters Sour Patch Kids Lemonhead ChicletsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started