Skip to content

to_csv issue #8621

Closed
Closed
@rmorgans

Description

@rmorgans

I have an issue using to_csv on a DataFrame object. It has a large number of columns d.shape = (3,454731).

Python 3.4.2 (default, Oct  8 2014, 13:44:52)
[GCC 4.9.1 20140903 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
>>> pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 3.4.2.final.0
python-bits: 64
OS: Linux
OS-release: 3.14.22-1-lts
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_AU.UTF-8

pandas: 0.15.0-16-g7012d71
nose: 1.3.4
Cython: 0.21.1
numpy: 1.9.0
scipy: 0.14.0
statsmodels: None
IPython: 2.3.0
sphinx: 1.2.3
patsy: 0.3.0
dateutil: 2.2
pytz: 2014.7
bottleneck: 0.8.0
tables: 3.1.1
numexpr: 2.4
matplotlib: 1.4.2
openpyxl: 1.8.6
xlrd: 0.9.3
xlwt: None
xlsxwriter: 0.5.7
lxml: 3.4.0
bs4: None
html5lib: 0.999
httplib2: None
apiclient: None
rpy2: None
sqlalchemy: 0.9.8
pymysql: None
psycopg2: 2.5.4 (dt dec pq3 ext)
>>> d=pd.read_msgpack('test.mpk')
>>> d.shape
(3, 454731)
>>> d.to_csv('test.csv')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.4/site-packages/pandas/util/decorators.py", line 88, in wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3.4/site-packages/pandas/core/frame.py", line 1154, in to_csv
    formatter.save()
  File "/usr/lib/python3.4/site-packages/pandas/core/format.py", line 1400, in save
    self._save()
  File "/usr/lib/python3.4/site-packages/pandas/core/format.py", line 1492, in _save
    chunks = int(nrows / chunksize) + 1
ZeroDivisionError: division by zero
>>> d.T.to_csv('test.csv')
>>>

Not sure what's going on here - I've written a nosetest here (any tips for improvements in my test?)

rmorgans@f3d0a9e

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIO CSVread_csv, to_csvOutput-Formatting__repr__ of pandas objects, to_string

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions