Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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 Chiclets

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

politeness and modesty, as well as indirectness;

Answered: 1 week ago