Tuesday, 28 May 2019

pandas df sort by abs

http://sofasofa.io/forum_main_post.php?postid=1000411
df.reindex(df['col_1'].abs().sort_values(ascending=False).index)

or just create a new columns for that

No comments:

Post a comment