-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
Allow dtype promotion in Series[ExtensionArray].__setitem__? #24020
Comments
Series[ExtensionArray].__setitem__
This seems like it might fit the method |
Similar issue encountered in #26041 (comment) with I'm +0.25 to coercing to object. It'd be great if the assignment "just works", but the object dtype tends to surprise people it seems. |
xref #39584 |
@MarcoGorelli is this closable as "no"? |
I'd say so yes, since pdep6 we've intentionally gone in the opposite direction closing for now then |
Pandas typically allows for
__setitem__
to change an object's dtype.This typically won't work for ExtensionArrays:
So, two questions:
ExtensionArray._can_hold_item(item: Type[scalar, Sequence[scalar]]) -> bool
. Or maybe the return could beTrue
for "I can hold this",False
for "No, raise an exception", and something else (a dtype?) for "Yes, but astype me to something else first)".I'm needing to work around this for DatetimeTZArray, since we do allow setting with a new timezone (upcasting to object).
The text was updated successfully, but these errors were encountered: