BUG: csv w only header and no index_col failing #10413

Closed
jreback opened this Issue Jun 23, 2015 · 1 comment

Comments

Projects
None yet
2 participants
Contributor

jreback commented Jun 23, 2015

after this fix pydata#10302

The following is failing (as index_col is None)

In [9]: data
Out[9]: 'header1,header2\n'

In [10]: read_csv(StringIO(data),iterator=True,index_col=False).read()      
TypeError: object of type 'bool' has no len()

jreback added this to the 0.17.0 milestone Jun 23, 2015

jreback closed this in #10469 Jul 7, 2015

paulogp commented Sep 17, 2015

I'm having the same issue with version 0.16.2. When reading a csv file that contains only headers (no data), for example:
first row: company;supplier;amount

And using pandas read_csv function to read the file (delimiter=";"; skiprows=0)
df = pd.read_csv(file, sep=delimiter, engine="c", quotechar='"', quoting=quote, skipinitialspace=True, skiprows=skiprows, prefix="NX", encoding="ISO-8859-1", error_bad_lines=False, index_col=False)

It returns the following error:
TypeError: object of type 'bool' has no len()

Removing the option index_col=False it starts working:
df = pd.read_csv(file, sep=delimiter, engine="c", quotechar='"', quoting=quote, skipinitialspace=True, skiprows=skiprows, prefix="NX", encoding="ISO-8859-1", error_bad_lines=False)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment