Skip to content

Commit 5703681

Browse files
committed
Attempting to fix some stuff
shallow_copy appears to no longer accept tz...
1 parent a15f098 commit 5703681

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pandas/core/indexes/datetimelike.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
import pandas.tseries.frequencies as frequencies
4343
from pandas.util._decorators import Appender, cache_readonly
4444
import pandas.core.dtypes.concat as _concat
45-
45+
import pandas.core.indexes.api as _api
4646

4747
import pandas.core.indexes.base as ibase
4848
_index_doc_kwargs = dict(ibase._index_doc_kwargs)
@@ -804,7 +804,8 @@ def intersection(self, other):
804804
self._assert_can_do_setop(other)
805805

806806
if self.equals(other):
807-
return self._get_consensus_name(other)
807+
name = _api._get_consensus_names((self, other))[0]
808+
return self._shallow_copy(self, name=name)
808809

809810
lengths = len(self), len(other)
810811
if lengths[0] == 0:
@@ -817,7 +818,6 @@ def intersection(self, other):
817818
not other._is_strictly_monotonic)):
818819
result = Index.intersection(self, other)
819820
result = self._shallow_copy(result._values, name=result.name,
820-
tz=getattr(self, 'tz', None),
821821
freq=None
822822
)
823823
if result.freq is None:
@@ -826,9 +826,9 @@ def intersection(self, other):
826826

827827
# Conditions met!
828828
intersected_slice = self._fast_intersection(other)
829-
intersected = self._shallow_copy(intersected_slice)
830-
return intersected._get_consensus_name(other)
831-
829+
name = _api._get_consensus_names((self, other))[0]
830+
intersected = self._shallow_copy(intersected_slice, name=name)
831+
return intersected
832832

833833
def _ensure_datetimelike_to_i8(other, to_utc=False):
834834
"""

0 commit comments

Comments
 (0)