Obviously, you should know what I want but the trick is to sort according to the group.
Take a look at the image and you should see two groups: "Best departing flights" and "Best returning flights". The dataframe should be sorted by total column in decreasing order
What I want the output to look like is:
Best departing flights
Price Total
49 49
55 55
129 258
Best returning flights
60 60
212 424
242 484
I tried posting the data using dput, but I couldn't because I made a function
Airline Date_of_Journey Source Destination Route Dep_Time Arrival_Time
1 Best departing flights
2 Air India 03/01/2019 Banglore New Delhi BLR → BOM → DEL 06:45 AM 12:15 PM
3 IndiGo 03/06/2019 Kolkata Banglore CCU → BLR 09:25 PM 12:05 AM
4 Jet Airways 03/01/2019 Banglore New Delhi BLR → BOM → DEL 08:55 AM 09:20 PM
5 Best returning flights
51 SpiceJet 03/06/2019 Kolkata Banglore CCU → BLR 05:15 PM 07:45 PM
6 SpiceJet 03/06/2019 Kolkata Banglore CCU → BLR 09:00 AM 11:30 AM
7 Vistara 03/01/2019 Banglore New Delhi BLR → DEL 09:10 PM 12:05 AM
Duration Total_Stops Additional_Info Price Total
1
2 5h 30m 1 stop No info 49 49
3 2h 40m non-stop No info 129 258
4 12h 25m 1 stop 1 Long layover 55 55
5
51 2h 30m non-stop No info 242 484
6 2h 30m non-stop No info 212 424
7 2h 55m non-stop No info 60 60