Skip to content

CLN: datetimelike setops #41750

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 2 commits into from
Jun 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions pandas/core/indexes/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,6 @@ def is_type_compatible(self, kind: str) -> bool:
# --------------------------------------------------------------------
# Set Operation Methods

def _difference(self, other, sort=None):
new_idx = super()._difference(other, sort=sort)._with_freq(None)
return new_idx

def _intersection(self, other: Index, sort=False) -> Index:
"""
intersection specialized to the case with matching dtypes.
Expand Down Expand Up @@ -781,13 +777,8 @@ def _union(self, other, sort):

if self._can_fast_union(other):
result = self._fast_union(other, sort=sort)
if sort is None:
# In the case where sort is None, _can_fast_union
# implies that result.freq should match self.freq
assert result.freq == self.freq, (result.freq, self.freq)
elif result.freq is None:
# TODO: no tests rely on this; needed?
result = result._with_freq("infer")
# in the case with sort=None, the _can_fast_union check ensures
# that result.freq == self.freq
return result
else:
i8self = Int64Index._simple_new(self.asi8)
Expand Down