almog / IBKR-to-1325-form

Processes Interactive Brokers CSV statement into Israel tax report form 1325
MIT License
3 stars 1 forks source link

parsing report error #4

Open gerilya opened 4 months ago

gerilya commented 4 months ago

The report was created according to Fintranslator's instructions available here.

Here is the error:

Enter the IBKR statement CSV path (default: 2023_ibkr_report.csv): test.csv
Enter the rate CSV file path (will try to find it at: usd_ils.csv or otherwise fetch it from BOI):
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniconda/base/envs/tfs-workshop-test1/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/homebrew/Caskroom/miniconda/base/envs/tfs-workshop-test1/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/USER/work/TEMP/IBKR-to-1325-form/src/__main__.py", line 115, in <module>
    main()
  File "/Users/USER/work/TEMP/IBKR-to-1325-form/src/__main__.py", line 35, in main
    result_df = statement_to_1325_form(schema_name_to_df['Trades'], rate_csv_path)
  File "/Users/USER/work/TEMP/IBKR-to-1325-form/src/statement_to_1325.py", line 13, in statement_to_1325_form
    df_statement["Date"] = pd.to_datetime(df_statement["Date/Time"]).dt.date
  File "/opt/homebrew/Caskroom/miniconda/base/envs/tfs-workshop-test1/lib/python3.9/site-packages/pandas/core/tools/datetimes.py", line 1112, in to_datetime
    values = convert_listlike(arg._values, format)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/tfs-workshop-test1/lib/python3.9/site-packages/pandas/core/tools/datetimes.py", line 488, in _convert_listlike_datetimes
    return _array_strptime_with_fallback(arg, name, utc, format, exact, errors)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/tfs-workshop-test1/lib/python3.9/site-packages/pandas/core/tools/datetimes.py", line 519, in _array_strptime_with_fallback
    result, timezones = array_strptime(arg, fmt, exact=exact, errors=errors, utc=utc)
  File "strptime.pyx", line 534, in pandas._libs.tslibs.strptime.array_strptime
  File "strptime.pyx", line 355, in pandas._libs.tslibs.strptime.array_strptime
ValueError: time data "2022-08-18" doesn't match format "%Y-%m-%d %H:%M:%S", at position 1. You might want to try:
    - passing `format` if your strings have a consistent format;
    - passing `format='ISO8601'` if your strings are all ISO8601 but not necessarily in exactly the same format;
    - passing `format='mixed'`, and the format will be inferred for each element individually. You might want to use `dayfirst` alongside this.