IOE error using dataframe.to_csv and dataframe.save to write data to files

1k views Asked by At

I was trying to save dataframe for later use in pandas. However, I had the error below.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/source/Linux/pkg/python-2.7.3/lib/python2.7/site-packages/pandas-0.11.0-py2.7-linux-x86_64.egg/pandas/core/series.py", line 2881, in to_csv
    encoding=encoding)
  File "/source/Linux/pkg/python-2.7.3/lib/python2.7/site-packages/pandas-0.11.0-py2.7-linux-x86_64.egg/pandas/core/frame.py", line 1393, in to_csv
    formatter.save()
  File "/source/Linux/pkg/python-2.7.3/lib/python2.7/site-packages/pandas-0.11.0-py2.7-linux-x86_64.egg/pandas/core/format.py", line 963, in save
    f.close()
IOError: [Errno 5] Input/output error

dataframe.save fails even for a simple object a = DataFrame({'a':[1,3,4],'b':[3,4,5]}).

1

There are 1 answers

3
JoeCondron On

The save method is deprecated. You should us to_pickle instead. It looks like you're using pandas 0.11 which quite old. The latest version is 0.16. You could also consider saving it to csv or HDF5. http://pandas.pydata.org/pandas-docs/stable/io.html