Skip to content

Commit d9e29f8

Browse files
Albert Villanova del Moraljreback
Albert Villanova del Moral
authored andcommitted
Create new DatetimeIndex from the Index.intersection result
1 parent e7bcd28 commit d9e29f8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/tseries/index.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1203,9 +1203,9 @@ def intersection(self, other):
12031203
not other.offset.isAnchored() or
12041204
(not self.is_monotonic or not other.is_monotonic)):
12051205
result = Index.intersection(self, other)
1206-
if isinstance(result, DatetimeIndex):
1207-
if result.freq is None:
1208-
result.offset = to_offset(result.inferred_freq)
1206+
result = self._simple_new(result._values, name=result.name, tz=result.tz)
1207+
if result.freq is None:
1208+
result.offset = to_offset(result.inferred_freq)
12091209
return result
12101210

12111211
if len(self) == 0:

0 commit comments

Comments
 (0)