Skip to content

read_csv fails when both converts and index_col are used on the same column #1835

@lodagro

Description

@lodagro
In [473]: d = """\
A;B
1;2
3;4
"""

In [474]: pandas.read_csv(StringIO(d), sep=';', converters={'A': lambda x: x}, index_col='A')
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-474-6bc08702ea91> in <module>()
...
KeyError: 'A'

In [475]: pandas.read_csv(StringIO(d), sep=';', converters={'A': lambda x: x}).set_index('A')
Out[475]: 
   B
A   
1  2
3  4

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIO DataIO issues that don't fit into a more specific label

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions