Skip to content

pandas.read_csv(..., skiprows=2, engine='c') with unix-style line breaks crashes python on windows #11020

Closed
@e-pet

Description

@e-pet

The following makes python crash ("Kernel died, restarting" in IPython) on my windows 7 machine:

import pandas
myfile = open("test.csv", "w", newline="\n")
myfile.write("blah\n\ncol_1,col_2,col_3\n\n")
myfile.close()
dat = pandas.read_csv("test.csv", skiprows=2, encoding="utf-8", engine="c")

Note the unix-style line breaks.

The test case seems to be pretty precise, since changing about anything leads to working code. I tried, e.g.,

  • with Windows-style line breaks ('\r\n' instead of '\n')
  • without the two initial lines and the skiprows parameter
  • with two empty initial lines
  • with just one initial line, containing text
  • with the 'python' engine,

and everything worked.

Here is the output of pandas.show_versions():

INSTALLED VERSIONS
------------------
commit: None
python: 3.4.3.final.0
python-bits: 64
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 61 Stepping 4, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.15.2
nose: 1.3.4
Cython: 0.22
numpy: 1.9.2
scipy: 0.15.1
statsmodels: 0.6.1
IPython: 3.0.0
sphinx: 1.2.3
patsy: 0.3.0
dateutil: 2.4.2
pytz: 2015.4
bottleneck: None
tables: 3.1.1
numexpr: 2.3.1
matplotlib: 1.4.3
openpyxl: 1.8.5
xlrd: 0.9.3
xlwt: None
xlsxwriter: 0.6.7
lxml: 3.4.2
bs4: 4.3.2
html5lib: None
httplib2: None
apiclient: None
rpy2: None
sqlalchemy: 0.9.9
pymysql: None
psycopg2: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions