aliquote.org

September 20, 2019

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

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