numpy.select()

numpy.select

numpy.select(condlist, choicelist, default=0) [source]

Return an array drawn from elements in choicelist, depending on conditions.

Parameters:

condlist : list of bool ndarrays

The list of conditions which determine from which array in choicelist the output elements are taken. When multiple conditions are satisfied, the first one encountered in condlist is used.

choicelist : list of ndarrays