Skip to content

BUG: Accept column indices for na_values in read_csv #14203

Closed
@gfyoung

Description

@gfyoung
>>> from pandas.compat import StringIO
>>> from pandas import read_csv
>>> data = 'a\nfoo\n1'
>>>
>>> read_csv(StringIO(data), na_values={0: 'foo'}, engine='c')
...
TypeError: Expected list, got set
>>> read_csv(StringIO(data), na_values={0: 'foo'}, engine='python')
     a
0  foo  # Should be NaN
1    1

This behaviour is slightly inconsistent with what we do with usecols for example, so it would be nice to be able to process column indices with na_values too.

xref #7119.

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