Skip to content

REF: use _wrap_joined_index in PeriodIndex.join #33736

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
Apr 23, 2020

Conversation

jbrockmendel
Copy link
Member

PeriodIndex defines _apply_meta, but that is made unnecessary by implementing _wrap_joined_index correctly.

Comment on lines +593 to +597
if is_period_dtype(self.dtype):
freq = self.freq
else:
self = cast(DatetimeTimedeltaMixin, self)
freq = self.freq if self._can_fast_union(other) else None
Copy link
Member

Choose a reason for hiding this comment

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

to avoid this pattern in the base class, could _can_fast_union be overridden in PeriodIndex to always return True.

Copy link
Member

Choose a reason for hiding this comment

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

on second thoughts perhaps put in DatetimeIndexOpsMixin and then it's overridden in DatetimeTimedeltaMixin and the cast is not necessary.

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 considered this, but im planning to implement an actual _can_fast_union for PeriodIndex before long

@simonjayhawkins simonjayhawkins added Index Related to the Index class or subclasses Period Period data type Refactor Internal refactoring of code labels Apr 23, 2020
@jreback jreback added this to the 1.1 milestone Apr 23, 2020
@jreback jreback merged commit f5a4e78 into pandas-dev:master Apr 23, 2020
@jbrockmendel jbrockmendel deleted the wrap_joined branch April 23, 2020 17:54
rhshadrach pushed a commit to rhshadrach/pandas that referenced this pull request May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Index Related to the Index class or subclasses Period Period data type Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants