Skip to content

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

Merged
merged 1 commit into from
Jul 9, 2018

Conversation

jbrockmendel
Copy link
Member

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.

@@ -108,38 +113,43 @@ def __getitem__(self, key):
if is_int:
val = getitem(key)
return self._box_func(val)

Copy link
Member Author

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)
Copy link
Member Author

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):
Copy link
Member

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

@jorisvandenbossche jorisvandenbossche changed the title Move most remaining arith helpers REF: Move most remaining arith helpers to datetimelike mixins Jul 8, 2018

return self._simple_new(result, **attribs)
def astype(self, dtype, copy=True):
if is_object_dtype(dtype):
Copy link
Contributor

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):
Copy link
Contributor

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

@jreback jreback added Refactor Internal refactoring of code Datetime Datetime data dtype labels Jul 8, 2018
@jreback jreback added this to the 0.24.0 milestone Jul 8, 2018
@jreback
Copy link
Contributor

jreback commented Jul 8, 2018

looks ok to me. merge on green.

@codecov
Copy link

codecov bot commented Jul 9, 2018

Codecov Report

Merging #21815 into master will increase coverage by 0.02%.
The diff coverage is 94.64%.

Impacted file tree graph

@@            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
Flag Coverage Δ
#multiple 90.3% <94.64%> (+0.02%) ⬆️
#single 42.1% <36.6%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/indexes/timedeltas.py 91.08% <ø> (+0.02%) ⬆️
pandas/core/indexes/period.py 94.24% <ø> (-0.16%) ⬇️
pandas/core/indexes/datetimes.py 95.1% <100%> (-0.04%) ⬇️
pandas/core/indexes/datetimelike.py 97.17% <100%> (+0.16%) ⬆️
pandas/core/arrays/timedelta.py 92.47% <92.85%> (+4.81%) ⬆️
pandas/core/arrays/datetimes.py 95.83% <94.44%> (+2.2%) ⬆️
pandas/core/arrays/datetimelike.py 93.68% <94.59%> (-0.04%) ⬇️
pandas/core/arrays/period.py 87.83% <95.65%> (+2.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c697ca6...8b93586. Read the comment docs.

@jreback jreback merged commit d05e8f2 into pandas-dev:master Jul 9, 2018
@jreback
Copy link
Contributor

jreback commented Jul 9, 2018

thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the dtarrays25 branch July 10, 2018 13:52
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants