2 ms·
And for this particular use case, numpy has .clip(), that takes: np.clip(ndarray, lower_bound, upper_bound) And handles NaNs correctly.
by dr_zoidberg 6y ago
And for this particular use case, numpy has .clip(), that takes:
np.clip(ndarray, lower_bound, upper_bound)
And handles NaNs correctly.