Skip to content

API/DEPR: error_bad_lines/warn_bad_lines in pd.read_csv #22677

Closed
@h-vetinari

Description

@h-vetinari

From discussion started in #22639:

Currently, pd.read_csv has two booleans

  • error_bad_lines : boolean, default True
    Lines with too many fields (e.g. a csv line with too many commas) will by default cause an exception to be raised, and no DataFrame will be returned. If False, then these “bad lines” will dropped from the DataFrame that is returned.
  • warn_bad_lines : boolean, default True
    If error_bad_lines is False, and warn_bad_lines is True, a warning for each “bad line” will be output.

This is confusing (what happens if both are True), and not in line with other errors-kwargs that are all around the place. Clearer would be something like: error_bad_lines = {'raise'|'warn'|'ignore'}, and removing warn_bad_lines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions