sorting row values alphabetical - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: sorting row values alphabetical (/thread-15673.html) |
sorting row values alphabetical - PolskaYBZ - Jan-27-2019 Hi, I have the below dataframe object in which I would like to sort the rows in alphabetical order. The textbook gives the below answer, which I understand.flights_sort = flights.apply(sorted, axis=1)I would however like to know for myself if there is a possibility if this is as well possible via the .sort_values() method. I tried every combination, but unfortunately I am not able to figure it out. Thanks :) RE: sorting row values alphabetical - stullis - Jan-27-2019 If you're using pandas, the documentation states that you can use the "by" keyword argument to sort by a particular column. |