MCPcopy
hub / github.com/quantopian/zipline / labelarray_where

Function labelarray_where

zipline/lib/labelarray.py:829–838  ·  view source on GitHub ↗

LabelArray-aware implementation of np.where.

(cond, trues, falses)

Source from the content-addressed store, hash-verified

827
828@expect_types(trues=LabelArray, falses=LabelArray)
829def labelarray_where(cond, trues, falses):
830 """LabelArray-aware implementation of np.where.
831 """
832 if trues.missing_value != falses.missing_value:
833 raise ValueError(
834 "Can't compute where on arrays with different missing values."
835 )
836
837 strs = np.where(cond, trues.as_string_array(), falses.as_string_array())
838 return LabelArray(strs, missing_value=trues.missing_value)

Callers 2

_computeMethod · 0.90

Calls 2

LabelArrayClass · 0.85
as_string_arrayMethod · 0.80

Tested by 1