Open numpy-gitbot opened 12 years ago
Original ticket http://projects.scipy.org/numpy/ticket/2190 on 2012-07-24 by trac user renaud.dussurget, assigned to unknown.
The function nanargmin, calling _nanop returns ValueError: cannot convert float NaN to integer when all values are masked (nans).
This occurs when the _nanop functions tries to fill the result array index (res) with NaN values. This, however, cannot work.
Indeed, the res array is initialized using the op (argmin in our case) function. This function returns an array of ints.
Thus the following line cannot work: res[np.arange(len(mask_all_along_axis)).compress(mask_all_along_axis)] = np.nan
A workaround to this is to replace the return value (NaNs) by -1(this will however affect the behaviour of the nansum function).
Original ticket http://projects.scipy.org/numpy/ticket/2190 on 2012-07-24 by trac user renaud.dussurget, assigned to unknown.
The function nanargmin, calling _nanop returns ValueError: cannot convert float NaN to integer when all values are masked (nans).
This occurs when the _nanop functions tries to fill the result array index (res) with NaN values. This, however, cannot work.
Indeed, the res array is initialized using the op (argmin in our case) function. This function returns an array of ints.
Thus the following line cannot work: res[np.arange(len(mask_all_along_axis)).compress(mask_all_along_axis)] = np.nan
A workaround to this is to replace the return value (NaNs) by -1(this will however affect the behaviour of the nansum function).