Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Sort dataframe by asc and desc

I have a data frame that has two columns, let’s call A and B I want to sort A desc and B asc.

In order words, I want a list of elements which has a minor value in columns A and a greater value in column B

Is it possible?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

pass 0 (false), 1 (true) to the ascending attribute in sort_values

df.sort_values(['cola','colb'], ascending=[0,1]

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading