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

Function test_min_max_element_wise

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

Source from the content-addressed store, hash-verified

3389
3390
3391def test_min_max_element_wise():
3392 arr1 = pa.array([1, 2, 3])
3393 arr2 = pa.array([3, 1, 2])
3394 arr3 = pa.array([2, 3, None])
3395
3396 result = pc.max_element_wise(arr1, arr2)
3397 assert result == pa.array([3, 2, 3])
3398 result = pc.min_element_wise(arr1, arr2)
3399 assert result == pa.array([1, 1, 2])
3400
3401 result = pc.max_element_wise(arr1, arr2, arr3)
3402 assert result == pa.array([3, 3, 3])
3403 result = pc.min_element_wise(arr1, arr2, arr3)
3404 assert result == pa.array([1, 1, 2])
3405
3406 # with specifying the option
3407 result = pc.max_element_wise(arr1, arr3, skip_nulls=True)
3408 assert result == pa.array([2, 3, 3])
3409 result = pc.min_element_wise(arr1, arr3, skip_nulls=True)
3410 assert result == pa.array([1, 2, 3])
3411 result = pc.max_element_wise(
3412 arr1, arr3, options=pc.ElementWiseAggregateOptions())
3413 assert result == pa.array([2, 3, 3])
3414 result = pc.min_element_wise(
3415 arr1, arr3, options=pc.ElementWiseAggregateOptions())
3416 assert result == pa.array([1, 2, 3])
3417
3418 # not skipping nulls
3419 result = pc.max_element_wise(arr1, arr3, skip_nulls=False)
3420 assert result == pa.array([2, 3, None])
3421 result = pc.min_element_wise(arr1, arr3, skip_nulls=False)
3422 assert result == pa.array([1, 2, None])
3423
3424
3425@pytest.mark.numpy

Callers

nothing calls this directly

Calls 2

arrayMethod · 0.45

Tested by

no test coverage detected