Repository: apache/arrow
File: python/pyarrow/tests/test_compute.py (Python)

Code before:
            If False, any null in the input forces the output to null.
        min_count : int, default 1
            Minimum number of non-null values in the input.  If the number
            of non-null values is below `min_count`, the output is null.
        options : pyarrow.compute.ScalarAggregateOptions, optional
            Alternative way of passing options.
        memory_pool : pyarrow.MemoryPool, optional
            If not passed, will allocate memory from the default memory pool.

        Examples
        --------
        >>> import pyarrow as pa
        >>> import pyarrow.compute as pc
        >>> arr1 = pa.array([1, 1, 2, 2, 3, 2, 2, 2])
        >>> pc.min_max(arr1)
        <pyarrow.StructScalar: [('min', 1), ('max', 3)]>

        Using `skip_nulls` to handle null values.

        >>> arr2 = pa.array([1.0, None, 2.0, 3.0])
        >>> pc.min_max(arr2)
        <pyarrow.StructScalar: [('min', 1.0), ('max', 3.0)]>
        >>> pc.min_max(arr2, skip_nulls=False)
        <pyarrow.StructScalar: [('min', None), ('max', None)]>

        Using `ScalarAggregateOptions` to control minimum number of non-null values.

        >>> arr3 = pa.array([1.0, None, float("nan"), 3.0])
        >>> pc.min_max(arr3)
        <pyarrow.StructScalar: [('min', 1.0), ('max', 3.0)]>
        >>> pc.min_max(arr3, options=pc.ScalarAggregateOptions(min_count=3))
        <pyarrow.StructScalar: [('min', 1.0), ('max', 3.0)]>
        >>> pc.min_max(arr3, options=pc.ScalarAggregateOptions(min_count=4))
        <pyarrow.StructScalar: [('min', None), ('max', None)]>

        This function also works with string values.

        >>> arr4 = pa.array(["z", None, "y", "x"])
        >>> pc.min_max(arr4)
        <pyarrow.StructScalar: [('min', 'x'), ('max', 'z')]>
        """)
    # Without options
    assert pc.add.__doc__ == textwrap.dedent("""\
        Add the arguments element-wise.

        Results will wrap around on integer overflow.
        Use function "add_checked" if you want overflow
        to return an error.

        Parameters
        ----------

Review comment (suggestion):
```suggestion
        Using ``ScalarAggregateOptions`` to control minimum number of non-null values.
```

Code after:
            If False, any null in the input forces the output to null.
        min_count : int, default 1
            Minimum number of non-null values in the input.  If the number
            of non-null values is below `min_count`, the output is null.
        options : pyarrow.compute.ScalarAggregateOptions, optional
            Alternative way of passing options.
        memory_pool : pyarrow.MemoryPool, optional
            If not passed, will allocate memory from the default memory pool.

        Examples
        --------
        >>> import pyarrow as pa
        >>> import pyarrow.compute as pc
        >>> arr1 = pa.array([1, 1, 2, 2, 3, 2, 2, 2])
        >>> pc.min_max(arr1)
        <pyarrow.StructScalar: [('min', 1), ('max', 3)]>

        Using ``skip_nulls`` to handle null values.

        >>> arr2 = pa.array([1.0, None, 2.0, 3.0])
        >>> pc.min_max(arr2)
        <pyarrow.StructScalar: [('min', 1.0), ('max', 3.0)]>
        >>> pc.min_max(arr2, skip_nulls=False)
        <pyarrow.StructScalar: [('min', None), ('max', None)]>

        Using ``ScalarAggregateOptions`` to control minimum number of non-null values.

        >>> arr3 = pa.array([1.0, None, float("nan"), 3.0])
        >>> pc.min_max(arr3)
        <pyarrow.StructScalar: [('min', 1.0), ('max', 3.0)]>
        >>> pc.min_max(arr3, options=pc.ScalarAggregateOptions(min_count=3))
        <pyarrow.StructScalar: [('min', 1.0), ('max', 3.0)]>
        >>> pc.min_max(arr3, options=pc.ScalarAggregateOptions(min_count=4))
        <pyarrow.StructScalar: [('min', None), ('max', None)]>

        This function also works with string values.

        >>> arr4 = pa.array(["z", None, "y", "x"])
        >>> pc.min_max(arr4)
        <pyarrow.StructScalar: [('min', 'x'), ('max', 'z')]>
        """)
    # Without options
    assert pc.add.__doc__ == textwrap.dedent("""\
        Add the arguments element-wise.

        Results will wrap around on integer overflow.
        Use function "add_checked" if you want overflow
        to return an error.

        Parameters
        ----------