Skip to content

BUG: to_datetime raising on invalid offsets with errors=coerce and infer_datetime_format #48676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

MarcoGorelli
Copy link
Member

@MarcoGorelli MarcoGorelli force-pushed the dont-raise-guessing-format-on-wrong-offset branch from cf5bc0a to 73611e8 Compare September 21, 2022 08:34
@MarcoGorelli MarcoGorelli added Bug Datetime Datetime data dtype labels Sep 21, 2022
@MarcoGorelli MarcoGorelli force-pushed the dont-raise-guessing-format-on-wrong-offset branch from 73611e8 to 4c00b86 Compare September 21, 2022 08:39
@MarcoGorelli MarcoGorelli marked this pull request as draft September 21, 2022 12:45
@MarcoGorelli MarcoGorelli marked this pull request as ready for review September 21, 2022 14:42
@MarcoGorelli MarcoGorelli marked this pull request as draft September 21, 2022 14:43
@MarcoGorelli MarcoGorelli marked this pull request as ready for review September 21, 2022 15:38
# GH 28299
ts_strings = ["200622-12-31", "111111-24-11"]
result = to_datetime(ts_strings, errors="coerce")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, do we have a similar test when errors="ignore"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch! indeed, that errors

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually it's fine (I may not have rebuilt my c extensions when I left the comment above) - have parametrised over errors in the test now, thanks

@MarcoGorelli MarcoGorelli marked this pull request as draft September 21, 2022 17:35
@MarcoGorelli MarcoGorelli marked this pull request as ready for review October 5, 2022 14:15
@mroeschke mroeschke added this to the 1.6 milestone Oct 5, 2022
@mroeschke mroeschke merged commit d8e7651 into pandas-dev:main Oct 5, 2022
@mroeschke
Copy link
Member

Thanks @MarcoGorelli

@mroeschke mroeschke modified the milestones: 1.6, 2.0 Oct 13, 2022
noatamir pushed a commit to noatamir/pandas that referenced this pull request Nov 9, 2022
…fer_datetime_format (pandas-dev#48676)

* BUG: to_datetime raising on invalid offsets with errors=coerce and infer_datetime_format

* fix invalid type test

* test errors=ignore as well

Co-authored-by: MarcoGorelli <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: to_datetime raises when errors=coerce and infer_datetime_format
2 participants