-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
isnan should not raise TypeErrors (Trac #709) #1307
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
@teoliphant wrote on 2008-04-03 Interesting suggestion, but this is a new feature. I'm moving it to 1.1 |
Milestone changed to |
Milestone changed to |
@mwiebe wrote on 2011-03-23 This requires adding an object-array loop to the 'isnan' ufunc, which would then return False for anything that's not a float, and run the regular isnan on floats. |
In the meantime, what is the recommended solution, do we check for types before we throw things at numpy.isnan? |
Example please. |
Here's the rather elaborate workaround I use in patsy: On Wed, Jul 17, 2013 at 3:53 AM, Charles Harris [email protected]:
|
Still open and worth considering. |
Although this seems to have been partially fixed on #14831, # This raises TypeError
np.isnan(
np.array([
[5],
[np.datetime64('2010-01-01')]
])
)
# Both of these work fine
np.isnan(
np.array([
[np.datetime64('2010-01-01')]
])
)
np.isnan(
np.array([
[5]
])
) I'm using numpy 1.18.2 |
By "mixed column types" you mean "when dtype is
This would start with adding a loop function to |
Closing. If this is needed for your workflow please reopen or open a new issue. |
Original ticket http://projects.scipy.org/numpy/ticket/709 on 2008-03-20 by trac user cjw296, assigned to unknown.
I'm faily sure that:
numpy.isnan(datetime.datetime.now())
...should just return False and not raise an exception.
rationale: anything that is not nan should just return False, not raise TypeErrors.
The text was updated successfully, but these errors were encountered: