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.