-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: nanops on empty Series have wrong type #7869
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
This is just an edge case in creation of the empty array. as you can see these work correctly (just not on an empty array).
|
tests for these types of things are in |
I still don't get why these tests don't belong in |
nanops only deals with very low level things. eg.. it knows nothing about wrapping the return results. |
The thing that's confusing me is that |
Edited title and code sample to more accurately reflect the issue. |
I was going back over this and noticed that
I don't know what the py3 issue is, but since we're dropping numpy <1.7 compatibility, can we get rid of this behavior? Having to strip the wrapper from a |
this is all fixed in #8184 merging shortly |
@ischwabacher sorry, what I mean is that that comment is removed (and a |
I was not following that patch. I have a lot of reading to do on my bus ride home tonight. |
haha, ok. Should be straightforward after that I think. In essecent, |
covering this in #8184. pretty easy. |
It looks like
_wrap_results
is doing double duty, both converting an output to the right time dtype, and wrapping that result in a series (I don't know why it does this), and in some cases results aren't getting wrapped. But the wrapper ignores other dtypes, which doesn't make sense to me; aside from the unfortunate fact that numpy provides no_NA_integer
equivalent, I as a user expect the dtype of a result to depend only on the dtype of the inputs, not on their shapes or values, so it would make sense to have a more general wrapper somewhere.I'm not sure how I'd implement such a wrapper, because ideally it would be able to handle situations like that the standard deviation of a
Series
ofdatetime64
s is atimedelta64
or such. Maybe that's a bit ambitious, though, since it's inching towards a general notion of symbolic units; in such a case the user can unwrap, operate and wrap manually.It looks like there are several points in pandas/core/nanops.py where a result is returned without wrapping, and I could submit a narrow PR for just this issue but I want to wait until I have time to really go over
nanops.py
and get all of these.The text was updated successfully, but these errors were encountered: