BUG: np.full_like
casts float to int for non-finite values
#21496
Labels
np.full_like
casts float to int for non-finite values
#21496
Describe the issue:
Please see the code snippet below. I create an integer array
a
, then create a new one (b
) which is supposed to have the same shape asa
, but filled with the float valuenp.nan
. Here, I don't explicitly set the dtype forb
. NumPy converts these float values to integer.This is unexpected behaviour, and I assume is not intended as such. I would have expected either
b
is automatically made a float-array (the dtype information froma
is not used), orReproduce the code example:
Error message:
No response
NumPy/Python version information:
1.22.3 3.8.12 (default, Oct 22 2021, 18:39:35)
[Clang 13.0.0 (clang-1300.0.29.3)]
The text was updated successfully, but these errors were encountered: