When talking about sorting, we need to think about what exactly we are sorting. There are rows, columns, their indices, and the data they contain. Let's first look at index sorting. We can use the sort_index method to rearrange the rows of a DataFrame so that the row indices are in order. We can also sort the columns by setting the access parameter of sort_index to 1. By default, sorting is done in ascending order; later rows have larger values than earlier rows, but we can change this behavior by setting the ascending value of the sort_index value to false. This sorts in descending order. By default, this is not done in place; you need to set the in place argument of sort_index to true for that.
While I have emphasized sorting for DataFrames, sorting a series is effectively the same. Let's see an example. After loading in NumPy and pandas, we create a...