Jan-27-2019, 10:35 AM
Hi,
I have the below dataframe object in which I would like to sort the rows in alphabetical order.
Thanks :)
I have the below dataframe object in which I would like to sort the rows in alphabetical order.
Output:
flights
ORG_AIR DEST_AIR
0 LAX SLC
1 DEN IAD
2 DFW VPS
3 DFW DCA
4 LAX MCI
5 IAH SAN
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 :)