0

I'm trying to figure out how to implement how excel sorts by levels if wanted in python with pandas (i.e. it sorts by column A, then by column B, then column C, etc.). Anyone have any advice with this?

Thank you. image of example

1 Answer 1

1
df.sort_values(['column A','column B','column C'], ascending  = True)
Sign up to request clarification or add additional context in comments.

2 Comments

This isn't working for me, it doesn't spit out any errors but it also doesn't actually do any sorting. A lot of the stuff I need to sort are alphanumerical strings, not values alone.
Never mind, I got it to work! Forgot to reassign the above to df.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.