numpy False 0:
>>>np.array([False,True,2,3])
array([0, 1, 2, 3])
, , , .
def get_data(replace_nan=False):
if replace_nan:
return np.where(np.isnan(data),replace_nan,data)
else:
return data[~numpy.isnan(data)]
numpy.where , NaN. replace_nan, , .
:
numpy.where(condition[, x, y])
Return elements, either from x or y, depending on condition.