From the course: pandas Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using sort_values()

Using sort_values() - pandas Tutorial

From the course: pandas Essential Training

Start my 1-month free trial

Using sort_values()

- [Instructor] Sort_values() sorts the values in a series. As axis is equal to zero, you are sorting along the column and in ascending order by default. So if you visualize a series as being a single column, you are sorting the contents of that column in ascending order. By default, the NaNs, or missing data, are put right at the end. Sort_values(), when used in conjunction with a DataFrame, is particularly useful as you can sort multiple series in ascending and descending order. Let's head over to the Jupyter Notebook for some examples. Let's sort by the athletes' names. So OO is the name of the DataFrame, Athlete gives us the details of the athlete's name, and sort_values(). So this provides us the list of all of the athletes' names sorted by the name of the athlete. Now if we look at the options available within sort values, hitting Shift + Tab provides one of the arguments, inplace equals false. The inplace argument is one we will see often. And by default, inplace is equal to…

Contents