-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Unable to use Series created with reindex_like with numpy.logical_and() #2388
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
x is object type and y is bool dtype. this works if you do reindex_like is going to introduce a bunch of NaNs so that's going to convert the Series into a bool dtype maybe we should call maybe_convert_objects at the end of fillna? |
Did something change recently to change this in 0.9.1? I've been told that the snippet above works in 0.9.0. I don't know how to get this exact version to test for myself though. As a side note, any time a Series has NaN it is automatically a bool dtype? So, anytime I call |
Right now fillna does NOT convert the type but reindex_like does. Because NaN is a float, after reindex_like the Series becomes mixed type so gets converted to object dtype |
To be clear: this is a wart due to pandas's "best efforts" implementation of missing data using NumPy. I would expect the same code to fail on 0.9.0 |
Is there a reason why |
Oh, I see what you mean. So is this technically a bug then? |
The reason I'm not using You can find more information about my exact situation on this stackoverflow post. |
Maybe this subtle issue should be mentioned in the docs for Also, how can I get 0.9.0 and test this? The person responding on my stackoverflow post claimed this worked with pandas 0.9.0 AND numpy 1.8. So, not sure what the difference in numpy is from 1.8 and 1.6.2 so might not be 'broken' in pandas 0.9.0. |
Shouldn't you use |
Yes, I can use |
Should I close this? I guess it's not actually a bug, just a subtle side-effect of |
Yeah let's close the issue. If you get energetic and want to add a caveat in the docs about using ufuncs on boolean arrays that have had missing data, go for it. Maybe on the gotchas page |
I'm using numpy 1.6.2, pandas 0.9.1, and Python 2.7.2. I see strange behavior when using
numpy.logical_and()
depending on how I create a Series object. For example:What is the difference between
x
andy
here that is causing theAttributeError
?Also, I originally posted this as a question on stackoverflow. There are comments saying this works with pandas 0.9.0 and numpy 1.8. I haven't verified this for myself yet. However, my scenario is using the most recent stable releases of both projects.
The text was updated successfully, but these errors were encountered: