-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
Series constructor doesn't handle object implementing numpy array interface #8311
Comments
IIRC this is an issue with |
hm. I'm on 2.4.3 which is the latest. I'm not seeing where in the constructor we'd be handling it, unless numpy itself is overloading the isinstance check. I gotta step out for a bit, but I'll dig into it when I get back. I know this used to work before. I don't use rpy2 regulary...I'm just fixing some tests that have been stuck at red for a long time :) |
this doesnt' have anything really to do with numpy. Its the |
Ah right. I was meaning that being a ndarray subclass would help the chances of The problem in master is: # series.py 198
if index is None:
if not is_list_like(data):
data = [data]
index = _default_index(len(data)) In 12.0 there is no So I'm thinking that we should have something like: if data has attr '__array_interface__' or '__array_struct__':
data = pa.array(data) I'm not entirely sure what the arr = rpy2.robjects.IntVector(range(10))
np.sum(arr) # 45 works fine. If we're cool with the array interface check, I'll throw up a PR tonight. |
you can check for 'array' is a more compat way you can try not sure if will work |
yar, it was meant to be pseudo-ish, gotta look around to see if there's an established way to check. Will report back. |
closing, but pls reopen if the issue persists. |
I guess this is a regression due to Series no longer being a subclass of np.ndarray. Not sure if
numpy
exposes a catchallisarray
that does the checks.The text was updated successfully, but these errors were encountered: