I have a pandas DataFrame output_df
that I can manipulate or print without problems. However, when I run output_df.to_csv(output_filename)
, it gives an error:
JavaScript
x
8
1
File "my_file.py", line 169, in run_attribute_generator
2
output_df.to_csv(output_filename)
3
File "/usr/local/lib/python3.6/site-packages/pandas/core/generic.py", line 3204, in to_csv
4
New Series or DataFrame with updated labels.
5
File "/usr/local/lib/python3.6/site-packages/pandas/io/formats/csvs.py", line 17, in <module>
6
from pandas.compat import (StringIO, range, zip)
7
ImportError: cannot import name 'StringIO'
8
My pandas version is 0.25.1
Advertisement
Answer
got it from here
It seems that you have to downgrade your pandas version to 0.24.2 or lower. Hope it helps