[ Web Proxy ]
URL:
Viewing: https://arrow.apache.org/docs/python/generated/../generated/../generated/pyarrow.compute.index.html [Back]  [Original]

pyarrow.compute.index — Apache Arrow v25.0.1
Back to top
Search the docs ...:

pyarrow.compute.index#

pyarrow.compute.index(data, value, start=None, end=None, *, memory_pool=None)[source]#

Find the index of the first occurrence of a given value.

Parameters:
dataArray-like
valueScalar-like object

The value to search for.

startint, optional
endint, optional
memory_poolMemoryPool, optional

If not passed, will allocate memory from the default memory pool.

Returns:
indexint

the index, or -1 if not found

Examples

>>> import pyarrow as pa
>>> import pyarrow.compute as pc
>>> arr = pa.array(["Lorem", "ipsum", "dolor", "sit", "Lorem", "ipsum"])
>>> pc.index(arr, "ipsum")
<pyarrow.Int64Scalar: 1>
>>> pc.index(arr, "ipsum", start=2)
<pyarrow.Int64Scalar: 5>
>>> pc.index(arr, "amet")
<pyarrow.Int64Scalar: -1>

Web Proxy Viewer  |  New URL  |  Original Page