Skip to content

ENH: Dtype._is_immutable #54421

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
Aug 6, 2023
Merged

ENH: Dtype._is_immutable #54421

merged 1 commit into from
Aug 6, 2023

Conversation

jbrockmendel
Copy link
Member

cc @phofl

Copy link
Member

@phofl phofl left a comment

Choose a reason for hiding this comment

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

lgtm

@phofl phofl added the ExtensionArray Extending pandas with custom dtypes or arrays. label Aug 6, 2023
@phofl phofl added this to the 2.1 milestone Aug 6, 2023
@phofl phofl merged commit 22a038e into pandas-dev:main Aug 6, 2023
@phofl
Copy link
Member

phofl commented Aug 6, 2023

thx @jbrockmendel

@jbrockmendel jbrockmendel deleted the enh-immutable branch August 6, 2023 14:36
@property
def _is_immutable(self) -> bool:
"""
Can arrays with this dtype be modified with __setitem__? If not, return
Copy link
Member

Choose a reason for hiding this comment

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

Should ExtensionArray.__setitem__ have a if dtype._is_immutable: raise TypeError check to solidify this?

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess that would be harmless since any working EA.__setitem__ would need to override

mroeschke pushed a commit to mroeschke/pandas that referenced this pull request Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ExtensionArray Extending pandas with custom dtypes or arrays.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants