You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently np.array([np.nan], dtype=np.int64) raises an error, however np.array([np.nan]).astype(np.int64) is undefined behavior that only issues a warning. Would it be worth promoting this to an error to stay consistent with np.array behavior?
Reproduce the code example:
importnumpyasnpnp.array([np.nan]).astype(np.int64) # Works while issuing 'invalid value' warningnp.array([np.nan], dtype=np.int64) # Raises 'ValueError: cannot convert float NaN to integer'
Error message:
No response
NumPy/Python version information:
1.24.0.dev0+578.g918065167 3.9.12 (main, Jun 1 2022, 11:38:51)
[GCC 7.5.0]
The text was updated successfully, but these errors were encountered:
Describe the issue:
Currently
np.array([np.nan], dtype=np.int64)
raises an error, howevernp.array([np.nan]).astype(np.int64)
is undefined behavior that only issues a warning. Would it be worth promoting this to an error to stay consistent withnp.array
behavior?Reproduce the code example:
Error message:
No response
NumPy/Python version information:
The text was updated successfully, but these errors were encountered: