Skip to content

move PeriodIndex comparisons, implement PeriodArray constructor #21798

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

PeriodIndex comparisons turn out to be easier to move than the others (though partly because ATM they are broken: #21793), so this moves them over first.

Following that, most of the remaining PeriodArray arithmetic methods require shift, which in turns requires the constructors, so I went ahead and implemented those in PeriodArrayMixin. Still holding off on TimedeltaArray and DatetimeArray constructors.

Found a few more things that could be harmlessly moved and some docstring fixups.

CC: @jorisvandenbossche @TomAugspurger @jreback

@@ -33,6 +35,47 @@ def f(self):
return property(f)


def _period_array_cmp(opname, cls):
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

in the future can you add some comments / doc-string here

@@ -161,3 +300,16 @@ def _maybe_convert_timedelta(self, other):
msg = "Input has different freq from {cls}(freq={freqstr})"
raise IncompatibleFrequency(msg.format(cls=type(self).__name__,
freqstr=self.freqstr))

@classmethod
Copy link
Contributor

Choose a reason for hiding this comment

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

should this use ExtensionOpsMixin ?

@jreback jreback added Period Period data type ExtensionArray Extending pandas with custom dtypes or arrays. labels Jul 7, 2018
@jreback jreback added this to the 0.24.0 milestone Jul 7, 2018
@jreback jreback merged commit eb95979 into pandas-dev:master Jul 7, 2018
@jreback
Copy link
Contributor

jreback commented Jul 7, 2018

thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the dtarrays23 branch July 7, 2018 21:24
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. Period Period data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants