Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
in case we have this fee dataframe: ``` N date amount description tax_year rate amount_rub abs_amount_del 0 1 2020-10-05 -0.01$ Other Fees - M******44:US CONSOLIDATED SNAPSHO... 2020 78.0915₽ -0.780915₽ 0.01 1 2 2020-10-05 0.01$ Other Fees - M******44:US CONSOLIDATED SNAPSHO... 2020 78.0915₽ 0.780915₽ 0.01 ``` after removing duplicates it becomes empty, so we'll face an error like this: ``` Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/eugeneleko/git/investments/investments/ibtax/__main__.py", line 3, in <module> main() File "/home/eugeneleko/git/investments/investments/ibtax/ibtax.py", line 307, in main fees_report = prepare_fees_report(fees, cbr_client_usd, args.verbose) if fees else None File "/home/eugeneleko/git/investments/investments/ibtax/ibtax.py", line 102, in prepare_fees_report df['amount_rub'] = df.apply(lambda x: cbr_client_usd.convert_to_rub(x['amount'], x[operation_date_column]), axis=1) File "/home/eugeneleko/.local/lib/python3.10/site-packages/pandas/core/frame.py", line 3645, in __setitem__ self._set_item_frame_value(key, value) File "/home/eugeneleko/.local/lib/python3.10/site-packages/pandas/core/frame.py", line 3788, in _set_item_frame_value self._set_item_mgr(key, arraylike) File "/home/eugeneleko/.local/lib/python3.10/site-packages/pandas/core/frame.py", line 3802, in _set_item_mgr self._mgr.insert(len(self._info_axis), key, value) File "/home/eugeneleko/.local/lib/python3.10/site-packages/pandas/core/internals/managers.py", line 1235, in insert raise ValueError( ValueError: Expected a 1D array, got an array with shape (0, 6) ``` So I suggest to move df['amount_rub'] calculation before removing duplicates
- Loading branch information