Skip to content

ERR: read_csv exposes an internal function when bad argument is specified #25648

Closed
@dsaxton

Description

@dsaxton

When a user tries to specify a non-existent argument in read_csv the error message pertains to what seems to be an internal function (parser_f). This behavior might be a bit surprising / confusing to users, who would expect the error message to refer to the function actually being used.

import pandas as pd
df = pd.read_csv("some_file.csv", bad_arg=True)

yields

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-d4606a60902f> in <module>()
----> 1 df = pd.read_csv("some_file.csv", bad_arg=True)

TypeError: parser_f() got an unexpected keyword argument 'bad_arg'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Error ReportingIncorrect or improved errors from pandasIO CSVread_csv, to_csvNeeds DiscussionRequires discussion from core team before further action

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions