I have a data set structured as follow. This a sample so please imagine a dataframe which contain many sequences. Few things to precise: time are in descending order. created_at is also in descending order. Both time and created_at reset when a new source OR currency comes up. index time app_v last source currency created_at 1 2019-10-23 3 4488 gol JPY 66 2 2019-10-23 29193 6687 gol JPY 65 3 2019-10-22 3 4587 gol JPY 64 4 2019-10-20 3 5687 gol JPY 63 5 2019-10-19 3 34787 gol JPY 62 6 2019-10-18 3 11789 gol JPY 61 ... The expected output is the latest last in terms of time grouped by source currency and app_v. For this sample, we have 2 rows corresponding: index time app_v last source currency created_at 1 2019-10-23 3 4488 gol JPY 66 2 2019-10-23 29193 6687 gol JPY 65 Continue reading...