-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
API: remove deep keyword from EA.copy #27083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
05ef547
4a599d3
6aaef12
5475643
cb5e1f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1262,12 +1262,8 @@ def searchsorted(self, v, side="left", sorter=None): | |
v, side, sorter | ||
) | ||
|
||
def copy(self, deep=False): | ||
if deep: | ||
values = self.sp_values.copy() | ||
else: | ||
values = self.sp_values | ||
|
||
def copy(self): | ||
values = self.sp_values.copy() | ||
return self._simple_new(values, self.sp_index, self.dtype) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @TomAugspurger do we need to copy the index here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not really sure. I don't know if they're designed for sharing across instances, or whether we mutate them inplace. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In any case in sparse.py, we don't mutate them inplace. I would also assume it is fine not to copy them. |
||
|
||
@classmethod | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,10 +101,8 @@ def take(self, indexer, allow_fill=False, fill_value=None): | |
allow_fill=allow_fill) | ||
return self._from_sequence(result) | ||
|
||
def copy(self, deep=False): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add a test in the pandas/tests/extension/constructors.py so it hits all EA's (for view & copy) |
||
if deep: | ||
return type(self)(self._data.copy()) | ||
return type(self)(self) | ||
def copy(self): | ||
return type(self)(self._data.copy()) | ||
|
||
def astype(self, dtype, copy=True): | ||
if isinstance(dtype, type(self.dtype)): | ||
|
Uh oh!
There was an error while loading. Please reload this page.