-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
ENH: infer_objects copy kwd #50096
ENH: infer_objects copy kwd #50096
Conversation
Thanks @jbrockmendel |
def convert(self: T, copy: bool) -> T: | ||
def _convert(arr): | ||
if is_object_dtype(arr.dtype): | ||
# extract PandasArray for tests that patch PandasArray._typ | ||
arr = np.asarray(arr) | ||
return lib.maybe_convert_objects( | ||
result = lib.maybe_convert_objects( | ||
arr, | ||
convert_datetime=True, | ||
convert_timedelta=True, | ||
convert_period=True, | ||
) | ||
if result is arr and copy: | ||
return arr.copy() | ||
return result | ||
else: | ||
return arr.copy() | ||
return arr.copy() if copy else arr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jbrockmendel sorry I was just about to ask - is there a test that hits this?
if not, then is it because the plan is to "kill arraymanager" anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a test that hits this?
TestInferObjects.test_copy should hit this in the CI build specific to ArrayManager
the plan is to "#48880 (comment)" anyway
I'd like this, but have no plans to push for it.
@jbrockmendel for 1.5 we had a discussion related to new |
Two big motivations. One was that we removed automatic inference in a few places, telling users to use infer_objects instead. Wanted to allow that operation to be cheap where possible. Second is that there was a bug in here in Block[Subclass].convert that was inconsistent about making copies. Fixing that bug required making more copies, and it's worth softening that blow. |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.