From 80986069435b6896087a9712ad88b093345a4de1 Mon Sep 17 00:00:00 2001 From: pixelsoup42 Date: Mon, 2 Oct 2023 10:44:54 +0200 Subject: [PATCH] fix duplicate timestamps --- src/cardano_account_pandas_dumper/__main__.py | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/cardano_account_pandas_dumper/__main__.py b/src/cardano_account_pandas_dumper/__main__.py index 01ab1ce..3c2eb77 100644 --- a/src/cardano_account_pandas_dumper/__main__.py +++ b/src/cardano_account_pandas_dumper/__main__.py @@ -184,23 +184,20 @@ def main(): with_rewards=not args.no_rewards, detail_level=args.detail_level, ) - transactions = ( - pd.Series( - {reporter.extract_timestamp(t): t for t in data_from_api.transactions} - | ( - {} - if args.no_rewards - else { - reporter.extract_timestamp(t): t - for t in [ - reporter.reward_transaction(r) for r in data_from_api.rewards - ] - } - ) + transactions = pd.concat( + [data_from_api.transactions] + + ( + [] + if args.no_rewards + else [ + pd.Series( + [reporter.reward_transaction(r) for r in data_from_api.rewards] + ) + ] ) - .rename("transactions") - .sort_index() ) + transactions.index = [reporter.extract_timestamp(t) for t in transactions] + transactions.sort_index(inplace=True) if args.csv_output: try: reporter.make_transaction_frame(