TIL about Numpy where. (via John Cook) #python

where

#python

from numpy import where from scipy import stats x = stats.norm.rvs(loc=0, scale=1, size=10) where(x < 0, 0, 1)