MCPcopy Create free account
hub / github.com/apache/arrow / test_index

Function test_index

python/pyarrow/tests/test_compute.py:2852–2863  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2850
2851
2852def test_index():
2853 arr = pa.array([0, 1, None, 3, 4], type=pa.int64())
2854 assert pc.index(arr, pa.scalar(0)).as_py() == 0
2855 assert pc.index(arr, pa.scalar(2, type=pa.int8())).as_py() == -1
2856 assert pc.index(arr, 4).as_py() == 4
2857 assert arr.index(3, start=2).as_py() == 3
2858 assert arr.index(None).as_py() == -1
2859
2860 arr = pa.chunked_array([[1, 2], [1, 3]], type=pa.int64())
2861 assert arr.index(1).as_py() == 0
2862 assert arr.index(1, start=2).as_py() == 2
2863 assert arr.index(1, start=1, end=2).as_py() == -1
2864
2865
2866def check_partition_nth(data, indices, pivot, null_placement):

Callers

nothing calls this directly

Calls 5

as_pyMethod · 0.80
chunked_arrayMethod · 0.80
arrayMethod · 0.45
indexMethod · 0.45
scalarMethod · 0.45

Tested by

no test coverage detected