Open
Description
Annoyingly, object arrays occur frequently because there is some text in the array when loading it, and in that context something like nan_to_num is often needed.
>>> arr = ndtest((2, 3)).astype(object)
>>> arr['a0', 'b1'] = la.nan
>>> arr
a\b b0 b1 b2
a0 0 nan 2
a1 3 4 5
>>> nan_to_num(arr)
a\b b0 b1 b2
a0 0 nan 2
a1 3 4 5
The workaround is to convert to float:
>>> nan_to_num(arr.astype(float))
a\b b0 b1 b2
a0 0.0 0.0 2.0
a1 3.0 4.0 5.0
I think I remember there was another issue regarding nan and object arrays, but I cannot find it anymore. I guess I fixed that problem without creating an issue about it, because general_isnan and obj_isnan in larray code were created exactly to alleviate this issue.