blosc2.contains#

blosc2.contains(ndarr: NDArray | NDField | C2Array, value: str | bytes | NDArray | NDField | C2Array, /) LazyExpr#

Check if the array contains a specified value.

Parameters:
Returns:

out – A lazy expression that can be evaluated to check if the value is contained in the array.

Return type:

LazyExpr

Examples

>>> import numpy as np
>>> import blosc2
>>> values = np.array([b"apple", b"xxbananaxxx", b"cherry", b"date"])
>>> text_values = blosc2.asarray(values)
>>> value_to_check = b"banana"
>>> expr = blosc2.contains(text_values, value_to_check)
>>> result = expr.compute()
>>> print("Contains 'banana':", result[:])
Contains 'banana': [False  True False False]