Skip to content

Commit 0d85e5c

Browse files
committed
ndframe and index __copy__ are now proper methods
1 parent d3bab58 commit 0d85e5c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pandas/core/generic.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3156,7 +3156,8 @@ def copy(self, deep=True):
31563156
data = self._data.copy(deep=deep)
31573157
return self._constructor(data).__finalize__(self)
31583158

3159-
__copy__ = copy
3159+
def __copy__(self, deep=True):
3160+
return self.copy(deep=deep)
31603161

31613162
def __deepcopy__(self, memo=None):
31623163
if memo is None:

pandas/indexes/base.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,8 @@ def copy(self, name=None, deep=False, dtype=None, **kwargs):
723723
new_index = new_index.astype(dtype)
724724
return new_index
725725

726-
__copy__ = copy
726+
def __copy__(self, **kwargs):
727+
return self.copy(**kwargs)
727728

728729
def _validate_names(self, name=None, names=None, deep=False):
729730
"""

0 commit comments

Comments
 (0)