-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Почему-то скрипту январские праздники не нравятся:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\AppData\Roaming\Python\Python311\site-packages\pandas\core\indexes\base.py", line 3803, in get_loc
return self._engine.get_loc(casted_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "pandas\_libs\index.pyx", line 516, in pandas._libs.index.DatetimeEngine.get_loc
File "pandas\_libs\index.pyx", line 550, in pandas._libs.index.DatetimeEngine.get_loc
KeyError: Timestamp('2022-01-04 00:00:00')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\AppData\Roaming\Python\Python311\site-packages\pandas\core\indexes\datetimes.py", line 736, in get_loc
return Index.get_loc(self, key, method, tolerance)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AppData\Roaming\Python\Python311\site-packages\pandas\core\indexes\base.py", line 3805, in get_loc
raise KeyError(key) from err
KeyError: Timestamp('2022-01-04 00:00:00')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\AppData\Roaming\Python\Python311\site-packages\investments\ibtax\__main__.py", line 3, in <module>
main()
File "C:\Users\AppData\Roaming\Python\Python311\site-packages\investments\ibtax\ibtax.py", line 307, in main
fees_report = prepare_fees_report(fees, cbr_client_usd, args.verbose) if fees else None
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AppData\Roaming\Python\Python311\site-packages\investments\ibtax\ibtax.py", line 94, in prepare_fees_report
df['rate'] = df.apply(lambda x: cbr_client_usd.get_rate(x['amount'].currency, x[operation_date_column]), axis=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AppData\Roaming\Python\Python311\site-packages\pandas\core\frame.py", line 9565, in apply
return op.apply().__finalize__(self, method="apply")
^^^^^^^^^^
File "C:\Users\AppData\Roaming\Python\Python311\site-packages\pandas\core\apply.py", line 746, in apply
return self.apply_standard()
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AppData\Roaming\Python\Python311\site-packages\pandas\core\apply.py", line 873, in apply_standard
results, res_index = self.apply_series_generator()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AppData\Roaming\Python\Python311\site-packages\pandas\core\apply.py", line 889, in apply_series_generator
results[i] = self.f(v)
^^^^^^^^^
File "C:\Users\AppData\Roaming\Python\Python311\site-packages\investments\ibtax\ibtax.py", line 94, in <lambda>
df['rate'] = df.apply(lambda x: cbr_client_usd.get_rate(x['amount'].currency, x[operation_date_column]), axis=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AppData\Roaming\Python\Python311\site-packages\investments\data_providers\cbr.py", line 41, in get_rate
return rates.loc[dt].item()
~~~~~~~~~^^^^
File "C:\Users\AppData\Roaming\Python\Python311\site-packages\pandas\core\indexing.py", line 1073, in __getitem__
return self._getitem_axis(maybe_callable, axis=axis)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AppData\Roaming\Python\Python311\site-packages\pandas\core\indexing.py", line 1312, in _getitem_axis
return self._get_label(key, axis=axis)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AppData\Roaming\Python\Python311\site-packages\pandas\core\indexing.py", line 1260, in _get_label
return self.obj.xs(label, axis=axis)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AppData\Roaming\Python\Python311\site-packages\pandas\core\generic.py", line 4056, in xs
loc = index.get_loc(key)
^^^^^^^^^^^^^^^^^^
File "C:\Users\AppData\Roaming\Python\Python311\site-packages\pandas\core\indexes\datetimes.py", line 738, in get_loc
raise KeyError(orig_key) from err
KeyError: Timestamp('2022-01-04 00:00:00')
Metadata
Metadata
Assignees
Labels
No labels