What do you want to save?
Add Code snippet
New code examples
-
Python 2022-03-27 09:15:15
sort by dataframe
df.sort_values(by='col1', ascending=False) Add solution -
Python 2022-02-10 06:10:01
sort df by column
df.sort_values(by='col1', ascending=False) Add solution -
Python 2022-01-29 10:51:12
sort dataframe by column
df.sort_values(by='col1', ascending=False) Add solution -
-
Python 2021-10-30 07:30:11
pandas sort by list
# Convert Tm-column to category and in set the sorter as categories hierarchy # Youc could also do both lines in one just appending the cat.set_categories() df.Tm = df.Tm.astype("category") df.Tm.cat.set_categories(sorter, inplace=True) print(d... Add solution
Best helpers
Florian Huit
+5
Huggy Buggy
+5
Joyo
+5
ImMathan
+5
Anugram
+5
Vy32
+5
SOUMEN
+5
Nelsonic
+5
Csandreas1
+5
B_archer
+5
Horse
+5
Kd88
+5
Shahruz Raad
+5
Mick Daw
+5
Czlsws
+5
Daniel Cook
+5