Hacker News new | ask | show | jobs
by dr_zoidberg 2128 days ago
And for this particular use case, numpy has .clip(), that takes:

    np.clip(ndarray, lower_bound, upper_bound)
And handles NaNs correctly.