Skip to content

API: combine 'coerce' and 'errors' keywords of to_datetime  #10653

Closed
@jorisvandenbossche

Description

@jorisvandenbossche

From #10636

When parsing an invalid date, there are some possible different actions to take:

  • ignore -> just returning the original value unparsed (errors='ignore')
  • raise an error (errors='raise')
  • coerce / convert to NaN (coerce=True)

AFAIK, these three options are just three different options and mutually exclusive (or is there somewhere in the codebase an interaction between both?), so they could be controlled by a single keyword.
Having two keyword can make it even confusing what you should expect when combining those two, eg the example of coerce=True and error=raise.

Proposal: add another 'coerce' option to the errors keyword that is equivalent to coerce=True

-> this gives the errors keyword three options: 'ignore'|'raise'|'coerce'

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