Skip to content

REF: move more methods to EAMixins #21782

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 7, 2018

Conversation

jbrockmendel
Copy link
Member

With the exception of the comparison ops, this is the last stuff that can be moved before I have to implement the constructors (and hence a buttload of tests). Let's get this out of the way first.

(For the comparison ops there is some super jujitsu that needs to be un-wound, so will do that separately)


Yields
-------
tstamp : Timestamp
Copy link
Member Author

Choose a reason for hiding this comment

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

changed from existing version on DatetimeIndex where it says

        Returns
        -------
        Timestamps : ndarray


Returns
-------
seconds : ndarray, Float64Index, or Series
Copy link
Member Author

Choose a reason for hiding this comment

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

updated docstring to include ndarray


if self.hasnans:
new_data[self._isnan] = tslib.NaT
new_data = PeriodArrayMixin._sub_period(self, other)

# TODO: Should name=self.name be passed here?
Copy link
Member Author

Choose a reason for hiding this comment

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

I think the answer to this is a) yes, but b) if we remove this method entirely then when the inherited method is called from __sub__ it will correctly get wrapped.

@codecov
Copy link

codecov bot commented Jul 7, 2018

Codecov Report

Merging #21782 into master will increase coverage by <.01%.
The diff coverage is 95%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #21782      +/-   ##
==========================================
+ Coverage   91.95%   91.95%   +<.01%     
==========================================
  Files         160      160              
  Lines       49820    49840      +20     
==========================================
+ Hits        45812    45832      +20     
  Misses       4008     4008
Flag Coverage Δ
#multiple 90.33% <95%> (ø) ⬆️
#single 42.08% <45%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/indexes/datetimes.py 95.23% <ø> (-0.06%) ⬇️
pandas/core/indexes/datetimelike.py 96.97% <ø> (-0.02%) ⬇️
pandas/core/arrays/datetimelike.py 94.62% <100%> (+0.24%) ⬆️
pandas/core/indexes/period.py 93.58% <100%> (+0.22%) ⬆️
pandas/core/indexes/timedeltas.py 91.02% <100%> (+0.02%) ⬆️
pandas/core/arrays/datetimes.py 100% <100%> (ø) ⬆️
pandas/core/arrays/period.py 89.77% <84.61%> (-0.9%) ⬇️
pandas/core/arrays/timedelta.py 98.27% <96%> (-1.73%) ⬇️

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 620abc4...10e5559. Read the comment docs.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

minor comments, either or in a followup is ok. merge away

@@ -33,6 +33,12 @@ def _box_func(self):
"""
raise com.AbstractMethodError(self)

def _box_values(self, values):
Copy link
Contributor

Choose a reason for hiding this comment

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

so for future, any methods that we implement in the sub classes but not here, should be an AbstractMethodError (not specific to this comment, just generally)

# GH#19042
return NotImplemented

opstr = '__{opname}__'.format(opname=op.__name__).replace('__r', '__')
Copy link
Contributor

Choose a reason for hiding this comment

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

we ought to have a method to do exactly this in the base ExtensionOpsMixin (but for later cleanup)

Returns
-------
seconds : ndarray, Float64Index, or Series
When the calling object is a TimedeltaArray, the return type
Copy link
Contributor

Choose a reason for hiding this comment

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

can you make this in to a list of these return values

@jreback jreback added the ExtensionArray Extending pandas with custom dtypes or arrays. label Jul 7, 2018
@jreback jreback added this to the 0.24.0 milestone Jul 7, 2018
@jreback jreback added the Refactor Internal refactoring of code label Jul 7, 2018
@jorisvandenbossche jorisvandenbossche changed the title move more methods to EAMixins REF: move more methods to EAMixins Jul 7, 2018
@jbrockmendel jbrockmendel merged commit e84cf2a into pandas-dev:master Jul 7, 2018
@jbrockmendel jbrockmendel deleted the dtarrays-constructors branch July 7, 2018 14:56
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
ExtensionArray Extending pandas with custom dtypes or arrays. Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants