turicreate.SArray.is_in

SArray.is_in(other)

Performs an element-wise search for each row in ‘other’.

Conceptually equivalent to:

>>> sa.apply(lambda x: x in other)

If the current SArray contains strings and other is a string. Produces a 1 for each row if the row is a substring of ‘other’, and 0 otherwise.

If the ‘other’ is a list or array, this produces a 1 for each row if the row is an element of ‘other’

Parameters:
other : list, array.array, str

The variable to search in.

Returns:
out : SArray

A binary SArray where a non-zero value denotes that row was was found in ‘other’. And 0 if it is not found.

See also

contains

Examples

>>> SArray(['ab','bc','cd']).is_in('abc')
dtype: int
Rows: 3
[1, 1, 0]
>>> SArray(['a','b','c']).is_in(['a','b'])
dtype: int
Rows: 3
[1, 1, 0]