-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat: add non_existent
arg to replace_time_zone
#15062
Conversation
b764012
to
ad4e103
Compare
ad4e103
to
342354a
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15062 +/- ##
==========================================
+ Coverage 81.06% 81.07% +0.01%
==========================================
Files 1342 1342
Lines 173935 174030 +95
Branches 2459 2459
==========================================
+ Hits 141000 141097 +97
+ Misses 32468 32467 -1
+ Partials 467 466 -1 ☔ View full report in Codecov by Sentry. |
@@ -669,6 +669,20 @@ def test_to_datetime_use_earliest(exact: bool) -> None: | |||
).item() | |||
|
|||
|
|||
def test_to_datetime_naive_format_and_time_zone() -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated to this PR, but codecov flagged it as uncovered, so it's a good chance to add it
004fb76
to
a81c0ab
Compare
a81c0ab
to
2d52b1c
Compare
948aebc
to
8db1fd2
Compare
I with I stumbled on this before I did this monstrousity
|
closes #11579
needs rebasing onto #14961
This allows users to do:
Currently there's no way to get that output, as non-existent datetimes just raise (you could convert to string, then use
to_datetime
withstrict=False
, but even then that would make all inputs which don't match the given format becomenull
with no way to distinguish the non-existent ones to the invalid ones from those which didn't match the given format)For now, I'm only adding it to
replace_time_zone
, and preserving current behaviour in other places. Addingnon_existent
toto_datetime
would require quite a refactor because of how this would interact withstrict
, but I think for now it's valuable enough to add this toreplace_time_zone