first and second have identical columns transaction_id, date
(datetime) and amount. The export overlapped, so a transaction can appear in
both.
Stack them, drop rows repeating a transaction_id already seen (keeping the
first occurrence), sort by date then transaction_id, and renumber the index
from 0.
Input
first =
transaction_id date amount
0 1 2022-01-31 10.0
1 2 2022-01-15 20.0
second =
transaction_id date amount
0 2 2022-01-15 20.0
1 3 2022-02-01 30.0
Output
transaction_id date amount
0 2 2022-01-15 20.0
1 1 2022-01-31 10.0
2 3 2022-02-01 30.0