From fa7780cdc40b3e1d3b024c69143e920ee5a20dad Mon Sep 17 00:00:00 2001 From: pixelsoup42 Date: Thu, 5 Oct 2023 15:40:29 +0200 Subject: [PATCH] revert nft mint change, combine scaling and rounding --- .../cardano_account_pandas_dumper.py | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/cardano_account_pandas_dumper/cardano_account_pandas_dumper.py b/src/cardano_account_pandas_dumper/cardano_account_pandas_dumper.py index 61648e6..95a676f 100644 --- a/src/cardano_account_pandas_dumper/cardano_account_pandas_dumper.py +++ b/src/cardano_account_pandas_dumper/cardano_account_pandas_dumper.py @@ -259,7 +259,9 @@ def _parse_nft_mint(self, meta: blockfrost.utils.Namespace) -> str: for policy, _v in meta_dict.items(): if policy == "version": continue - result += f"{self._format_policy(policy)}:{_v.to_dict()}" + result += f"{self._format_policy(policy)}:" + for asset_name in _v.to_dict().keys(): + result += f"{asset_name} " return result def _format_message(self, tx_obj: blockfrost.utils.Namespace) -> str: @@ -497,15 +499,6 @@ def make_balance_frame( .sum(numeric_only=True) .T ) - - # Scale by asset decimals - balance = balance * [ - np.float_power( - 10, - np.negative(self.asset_decimals[c[0]]), - ) - for c in balance.columns - ] if with_total: balance = pd.concat( [ @@ -519,8 +512,19 @@ def make_balance_frame( ), ] ) + balance = pd.concat( - [balance[c].round(self.asset_decimals[c[0]]) for c in balance.columns], + [ + balance[c] + .mul( + np.float_power( + 10, + np.negative(self.asset_decimals[c[0]]), + ) + ) + .round(self.asset_decimals[c[0]]) + for c in balance.columns + ], axis=1, )