Skip to content

to_csv() fail on 0.11.dev #3163

Closed
Closed
@gdraps

Description

@gdraps

Hit this after updating to '0.11.0.dev-da54321' from master. Haven't had a chance to dig any deeper, other than isolate frame length as a factor.

df = pandas.util.testing.makeTimeDataFrame(25000)
df.to_csv("save.csv")  # works
df = pandas.util.testing.makeTimeDataFrame(25001)
df.to_csv("save.csv")  # throws exception below

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-83-12cc25e3eafd> in <module>()
----> 1 df.to_csv("save.csv")

/usr/local/lib/python2.7/dist-packages/pandas-0.11.0.dev_da54321-py2.7-linux-i686.egg/pandas/core/frame.pyc in to_csv(self, path_or_buf, sep, na_rep, float_format, cols, header, index, index_label, mode, nanRep, encoding, quoting, line_terminator, chunksize, **kwds)
   1348                                          index_label=index_label,
   1349                                          chunksize=chunksize,legacy=kwds.get("legacy",False) )
-> 1350             formatter.save()
   1351 
   1352     def to_excel(self, excel_writer, sheet_name='sheet1', na_rep='',

/usr/local/lib/python2.7/dist-packages/pandas-0.11.0.dev_da54321-py2.7-linux-i686.egg/pandas/core/format.pyc in save(self)
    936 
    937             else:
--> 938                 self._save()
    939 
    940 

/usr/local/lib/python2.7/dist-packages/pandas-0.11.0.dev_da54321-py2.7-linux-i686.egg/pandas/core/format.pyc in _save(self)
   1008                 break
   1009 
-> 1010             self._save_chunk(start_i, end_i)
   1011 
   1012     def _save_chunk(self, start_i, end_i):

/usr/local/lib/python2.7/dist-packages/pandas-0.11.0.dev_da54321-py2.7-linux-i686.egg/pandas/core/format.pyc in _save_chunk(self, start_i, end_i)
   1029         ix = data_index.to_native_types(slicer=slicer, na_rep=self.na_rep, float_format=self.float_format)
   1030 
-> 1031         lib.write_csv_rows(self.data, ix, self.nlevels, self.cols, self.writer)
   1032 
   1033 # from collections import namedtuple

/usr/local/lib/python2.7/dist-packages/pandas-0.11.0.dev_da54321-py2.7-linux-i686.egg/pandas/lib.so in pandas.lib.write_csv_rows (pandas/lib.c:13152)()

IndexError: list index out of range

Current workaround:

df.to_csv("save.csv", legacy=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIO DataIO issues that don't fit into a more specific label

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions