Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialgivens
7,484 Pointssort_values creates new DataFrame
Craig says this:
You'll notice that sort_values call actually created a new DataFrame. If you want to permanently change the sort from the default (sorted by index), you can pass True as an argument to the inplace keyword parameter.
My question is this:
How can you tell?
1 Answer
Mark Chesney
11,747 PointsHi givens,
I found this a curious statement too, as I read it, and so I ran this second line:
users.sort_values(by='balance', ascending=False).head()
users.head() # my line
And sure enough, by default, users
was still sorted alphabetically by index, the first row with an index of aaron
Neat, huh?