-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
REF: Move most remaining arith helpers to datetimelike mixins #21815
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
@@ -108,38 +113,43 @@ def __getitem__(self, key): | |||
if is_int: | |||
val = getitem(key) | |||
return self._box_func(val) | |||
|
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.
Just de-indenting this block, requested on the previous PR.
def astype(self, dtype, copy=True): | ||
if is_object_dtype(dtype): | ||
return self._box_values(self.asi8) | ||
return super(DatetimeLikeArrayMixin, self).astype(dtype, copy) |
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.
self.astype('O')
is used a few times, so that's the only one we need for now
@@ -113,12 +115,23 @@ def freq(self, value): | |||
|
|||
_attributes = ["freq"] | |||
|
|||
def __new__(cls, values, freq=None, **kwargs): |
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.
maybe add a todo comment to convert this to init once the Mixin is converted to proper array
|
||
return self._simple_new(result, **attribs) | ||
def astype(self, dtype, copy=True): | ||
if is_object_dtype(dtype): |
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.
at some point pls add a doc-string
assert list(asobj) == list(dti) | ||
|
||
|
||
class TestTimedeltaArray(object): |
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.
k for now, maybe split to sub-dirs at some point
looks ok to me. merge on green. |
Codecov Report
@@ Coverage Diff @@
## master #21815 +/- ##
==========================================
+ Coverage 91.9% 91.92% +0.02%
==========================================
Files 160 160
Lines 49892 49914 +22
==========================================
+ Hits 45852 45883 +31
+ Misses 4040 4031 -9
Continue to review full report at Codecov.
|
thanks @jbrockmendel |
Before we can finally move over
_add_datetimelike_methods
and be done with this, some more work needs to go into the__new__
methods. This gets another big chunk through, starts implementing tests.