-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ExtensionArray.__fillna__ should not use lib.is_scalar #20411
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
Comments
The same for geopandas. However, in general, also the This might not be easy to solve in general, it's mainly due to our flexible API where we need to interpret a lot about what is passed in .. |
Actually, even simpler example where a length check will not work: strings. |
Hmm hadn't thought that through. Perhaps we require that |
But in this case you can still fill with But such a requirement might be a good idea. Or we could also check it being "array-like" (check if is has a shape and if that shape matches). |
is_array_like seems to be what we want, since we do use boolean masking on
it.
…On Mon, Mar 19, 2018 at 12:13 PM, Joris Van den Bossche < ***@***.***> wrote:
at the cost of requiring IPArray([]).fillna(['192.168.1.1']) to be
written as IPArray([]).fillna(IPArray(['192.168.1.1'])).
But in this case you can still fill with IPArray([]).fillna('192.168.1.1')
(filling with a scalar) ?
But such a requirement might be a good idea. Or we could also check it
being "array-like" (check if is has a shape and if that shape matches).
In the current implementation, I don't think that a list (instead of
array) would work anyhow, because we apply a boolean mask on it?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#20411 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABQHIrUbFUoz-ormBr7bN5A8PzEJNsdVks5tf-c3gaJpZM4SwWBZ>
.
|
lib.is_scalar
is a bit too strict for the check we do inpandas/pandas/core/arrays/base.py
Line 272 in 7273ea0
ipaddress.IPv4Address
as a scalar.Replacing that check with a
hasattr(value, '__len__')
should be sufficient.The text was updated successfully, but these errors were encountered: