Skip to content

BUG: unhelpful parser exception when passing names and dtype #8833

Closed
@jreback

Description

@jreback
In [1]: data = """1.0 1
   ...: 2.0 2
   ...: 3.0 3"""

In [2]: read_csv(StringIO(data),sep='\s+')
Out[2]: 
   1.0  1
0    2  2
1    3  3

In [3]: read_csv(StringIO(data),sep='\s+',header=None)
Out[3]: 
   0  1
0  1  1
1  2  2
2  3  3

In [4]: read_csv(StringIO(data),sep='\s+',header=None,names=['a','b'])
Out[4]: 
   a  b
0  1  1
1  2  2
2  3  3

In [6]: read_csv(StringIO(data),sep='\s+',header=None,names=['a','b'],dtype={'a' : int})
'NoneType' object has no attribute 'dtype'

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugError ReportingIncorrect or improved errors from pandasIO CSVread_csv, to_csv

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions