A hands-on guide to ‘sorting’ dataframes in Pandas

By Medium - 2021-03-22

Description

My tryst with the pandas' library continues. Of late, I have been trying to look deeper into this library and consolidating some of the pandas’ features in byte-sized articles. I have written…

Summary

  • Ten ways to sort data in pandas My tryst with the pandas' library continues.
  • forks = df.sort_values(by='Forks',ascending=False)forks.head(10) Sorting on a single column | Image by Author The function dataframe.sort_values comes with a lot of parameters.
  • Ignore the index while sorting The index column can also be ignored entirely while sorting the dataframe.
  • col.str.lower())[:5] Apply the key function to the values before sorting | Image by Author Conclusion and additional resources In this article we looked at the different ways of sorting a dataframe using the pandas library.

 

Topics

  1. Coding (0.2)
  2. Backend (0.08)
  3. NLP (0.06)

Similar Articles

Reducing memory usage in pandas with smaller datatypes

By Medium - 2021-03-15

Managing large datasets with pandas is a pretty common issue. As a result, a lot of libraries and tools have been developed to ease that pain. Take, for instance, the pydatatable library mentioned…

Automatic Social Share Images

By ryanfiller.com - 2020-12-11

I am a designer, developer, illustrator, and maker living and working in Memphis, Tennessee. This is my blog and portfolio.