robinhood-to-csv icon indicating copy to clipboard operation
robinhood-to-csv copied to clipboard

profit_extractor.py runs into ParserError for regular trades

Open atiq-cs opened this issue 2 years ago • 0 comments

While the run without --profit works without problems, profit calculation is encountering ParserError every time!

$ python csv-export.py --profit
Username:
Password:
MFA:
Generated device token: 

Pulling trades. Please wait...
0 queued trades and 473 executed trades found in your account.
Choose a filename or press enter to save to `robinhood.csv`:

What is your tax multiplier -default 0.25 (25%) ?
Traceback (most recent call last):
  File "D:\python\robinhood-to-csv\csv-export.py", line 238, in <module>
    profit_csv = profit_extractor(csv, filename)
  File "D:\python\robinhood-to-csv\profit_extractor.py", line 20, in profit_extractor
    handle_raw = pd.read_csv(filename)
  File "D:\python\robinhood-to-csv\env\lib\site-packages\pandas\util\_decorators.py", line 311, in wrapper
    return func(*args, **kwargs)
  File "D:\python\robinhood-to-csv\env\lib\site-packages\pandas\io\parsers\readers.py", line 680, in read_csv
    return _read(filepath_or_buffer, kwds)
  File "D:\python\robinhood-to-csv\env\lib\site-packages\pandas\io\parsers\readers.py", line 581, in _read
    return parser.read(nrows)
  File "D:\python\robinhood-to-csv\env\lib\site-packages\pandas\io\parsers\readers.py", line 1254, in read
    index, columns, col_dict = self._engine.read(nrows)
  File "D:\python\robinhood-to-csv\env\lib\site-packages\pandas\io\parsers\c_parser_wrapper.py", line 225, in read
    chunks = self._reader.read_low_memory(nrows)
  File "pandas\_libs\parsers.pyx", line 805, in pandas._libs.parsers.TextReader.read_low_memory
  File "pandas\_libs\parsers.pyx", line 861, in pandas._libs.parsers.TextReader._read_rows
  File "pandas\_libs\parsers.pyx", line 847, in pandas._libs.parsers.TextReader._tokenize_rows
  File "pandas\_libs\parsers.pyx", line 1960, in pandas._libs.parsers.raise_parser_error
pandas.errors.ParserError: Error tokenizing data. C error: Expected 55 fields in line 237, saw 57

Python Info

$ python -V
Python 3.10.4

atiq-cs avatar Apr 09 '22 23:04 atiq-cs