laroche/tastyworks-pnl

Problem with --tax-output=2021

flanello opened this issue · 1 comments

Hello,
at first, thanks for the cool software.
Without the option --tax-output=2021 the program works fine.

However, when using the option --tax-output=2021 it prints the summary for 2021 on the command line but the csv file is not generated. It breaks with the following trace.

Traceback (most recent call last):
File "./tw-pnl.py", line 1124, in
main(sys.argv[1:])
File "./tw-pnl.py", line 1121, in main
check(all_wk, output_summary, output_csv, output_excel, tax_output, show)
File "./tw-pnl.py", line 1046, in check
new_wk = append_yearly_stats(new_wk, tax_output, stats, min_year, max_year)
File "./tw-pnl.py", line 710, in append_yearly_stats
df = df_append_row(df, ['', '', '', '', '', '', '', '', '', '', ''] + end)
File "./tw-pnl.py", line 465, in df_append_row
df.loc[len(df)] = row
File "/usr/lib/python3/dist-packages/pandas/core/indexing.py", line 723, in setitem
iloc._setitem_with_indexer(indexer, value, self.name)
File "/usr/lib/python3/dist-packages/pandas/core/indexing.py", line 1724, in _setitem_with_indexer
self._setitem_with_indexer_missing(indexer, value)
File "/usr/lib/python3/dist-packages/pandas/core/indexing.py", line 2027, in _setitem_with_indexer_missing
raise ValueError("cannot set a row with mismatched columns")
ValueError: cannot set a row with mismatched columns

Thanks for this report. (So much for writing a change without testing it.)

A fix is pushed into the repository, please report if further problem still show up or this fix does not work for you.

regards from Stuttgart,

Florian La Roche