Skip to content

REF: collect casting portion of Block.setitem #32940

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

Merged
merged 1 commit into from
Mar 25, 2020

Conversation

jbrockmendel
Copy link
Member

Block.setitem is sometimes inplace and sometimes casts/copies. The idea here is to isolate the casting cases and eventually separate them into their own method, so we can be more careful about when we call the inplace vs not-inplace setters.

assert not is_dtype_equal(self.dtype, dtype)
# otherwise should have _can_hold_element

return self.astype(dtype).setitem(indexer, value)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we do copy=False internally in .astype?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the default kwarg for Block.astype, yes

@jreback jreback added Dtype Conversions Unexpected or buggy dtype conversions Indexing Related to indexing on series/frames, not to indexes themselves Internals Related to non-user accessible pandas implementation labels Mar 24, 2020
@jreback jreback added this to the 1.1 milestone Mar 24, 2020
@jreback jreback merged commit b8035bb into pandas-dev:master Mar 25, 2020
@jbrockmendel jbrockmendel deleted the setitem-find_dtype branch March 25, 2020 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions Indexing Related to indexing on series/frames, not to indexes themselves Internals Related to non-user accessible pandas implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants