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:
File "my_file.py", line 169, in run_attribute_generator
output_df.to_csv(output_filename)
File "/usr/local/lib/python3.6/site-packages/pandas/core/generic.py", line 3204, in to_csv
New Series or DataFrame with updated labels.
File "/usr/local/lib/python3.6/site-packages/pandas/io/formats/csvs.py", line 17, in <module>
from pandas.compat import (StringIO, range, zip)
ImportError: cannot import name 'StringIO'
My pandas version is 0.25.1
got it from here
It seems that you have to downgrade your pandas version to 0.24.2 or lower. Hope it helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.