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:3533–3564  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3531
3532
3533def test_min_max_element_wise():
3534 arr1 = pa.array([1, 2, 3])
3535 arr2 = pa.array([3, 1, 2])
3536 arr3 = pa.array([2, 3, None])
3537
3538 result = pc.max_element_wise(arr1, arr2)
3539 assert result == pa.array([3, 2, 3])
3540 result = pc.min_element_wise(arr1, arr2)
3541 assert result == pa.array([1, 1, 2])
3542
3543 result = pc.max_element_wise(arr1, arr2, arr3)
3544 assert result == pa.array([3, 3, 3])
3545 result = pc.min_element_wise(arr1, arr2, arr3)
3546 assert result == pa.array([1, 1, 2])
3547
3548 # with specifying the option
3549 result = pc.max_element_wise(arr1, arr3, skip_nulls=True)
3550 assert result == pa.array([2, 3, 3])
3551 result = pc.min_element_wise(arr1, arr3, skip_nulls=True)
3552 assert result == pa.array([1, 2, 3])
3553 result = pc.max_element_wise(
3554 arr1, arr3, options=pc.ElementWiseAggregateOptions())
3555 assert result == pa.array([2, 3, 3])
3556 result = pc.min_element_wise(
3557 arr1, arr3, options=pc.ElementWiseAggregateOptions())
3558 assert result == pa.array([1, 2, 3])
3559
3560 # not skipping nulls
3561 result = pc.max_element_wise(arr1, arr3, skip_nulls=False)
3562 assert result == pa.array([2, 3, None])
3563 result = pc.min_element_wise(arr1, arr3, skip_nulls=False)
3564 assert result == pa.array([1, 2, None])
3565
3566
3567@pytest.mark.numpy

Callers

nothing calls this directly

Calls 2

arrayMethod · 0.45

Tested by

no test coverage detected