-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Make DTA _check_compatible_with less strict by default #30721
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
@@ -123,6 +123,9 @@ def _check_compatible_with( | |||
Parameters | |||
---------- | |||
other | |||
strict : bool, default False | |||
For __setitem__ we may have stricter compatiblity resrictions than |
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.
don’t we always need to check this for date times? why do u actually need a keyword
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.
ATM we dont use _check_compatible_with in the DTA comparison ops, but after this we will be able to.
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.
can you call this something else besides strict as this only applies to DTI, maybe check_tz (and ignore this elsewhere). i know strict is more generic, but also very confusing.
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.
changed "strict"->"setitem"
updated+green |
One of the two non-cosmetic things mentioned in #30720.
There are a bunch of places where DTA or DTI do a compatibility check that for tz_awareness_compat, but not requiring the same tz. This check is analogous to
PeriodArray._check_compatible_with
andTimedeltaArray._check_compatible_with
, so this adds a kwarg to _check_compatible_with so that we can use _check_compatible_with in all the relevant places and subsequently de-duplicate a bunch of code.In addition to the comparisons, this is going to be relevant for searchsorted and insert, where we have slightly different behavior in a bunch of EA/Index subclasses.