Skip to content

Commit 6661e32

Browse files
committed
relocated Index.__deepcopy__ to live near __copy__
1 parent f747216 commit 6661e32

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pandas/indexes/base.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,11 @@ def copy(self, name=None, deep=False, dtype=None, **kwargs):
726726
def __copy__(self, **kwargs):
727727
return self.copy(**kwargs)
728728

729+
def __deepcopy__(self, memo=None):
730+
if memo is None:
731+
memo = {}
732+
return self.copy(deep=True)
733+
729734
def _validate_names(self, name=None, names=None, deep=False):
730735
"""
731736
Handles the quirks of having a singular 'name' parameter for general
@@ -1476,11 +1481,6 @@ def __setstate__(self, state):
14761481

14771482
_unpickle_compat = __setstate__
14781483

1479-
def __deepcopy__(self, memo=None):
1480-
if memo is None:
1481-
memo = {}
1482-
return self.copy(deep=True)
1483-
14841484
def __nonzero__(self):
14851485
raise ValueError("The truth value of a {0} is ambiguous. "
14861486
"Use a.empty, a.bool(), a.item(), a.any() or a.all()."

0 commit comments

Comments
 (0)