Skip to content
Prev Previous commit
Next Next commit
Switch
  • Loading branch information
phofl committed Mar 14, 2023
commit 538a3f8d22a6f6f3c3f11d4d1f3324b323fb2edc
2 changes: 1 addition & 1 deletion pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1031,8 +1031,8 @@ def astype(self, dtype, copy: bool = True):
result = Index(new_values, name=self.name, dtype=new_values.dtype, copy=False)
if (
not copy
and astype_is_view(self.dtype, dtype)
and self._references is not None
and astype_is_view(self.dtype, dtype)
):
result._references = self._references
result._references.add_index_reference(result)
Expand Down