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

Code before:

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

    This function also works with string values.

    >>> arr4 = pa.array(["z", None, "y", "x"])
    >>> pc.min(arr4)
    <pyarrow.StringScalar: 'x'>
    """

function_doc_additions["max"] = """
    Examples
    --------
    >>> import pyarrow as pa
    >>> import pyarrow.compute as pc
    >>> arr1 = pa.array([1, 1, 2, 2, 3, 2, 2, 2])
    >>> pc.max(arr1)
    <pyarrow.Int64Scalar: 3>

    Using `skip_nulls` to handle null values.

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

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

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

    This function also works with string values.

    >>> arr4 = pa.array(["z", None, "y", "x"])
    >>> pc.max(arr4)
    <pyarrow.StringScalar: 'z'>
    """

function_doc_additions["min_max"] = """

Review comment (suggestion):
```suggestion
    Using ``skip_nulls`` to handle null values.
```

Code after:

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

    This function also works with string values.

    >>> arr4 = pa.array(["z", None, "y", "x"])
    >>> pc.min(arr4)
    <pyarrow.StringScalar: 'x'>
    """

function_doc_additions["max"] = """
    Examples
    --------
    >>> import pyarrow as pa
    >>> import pyarrow.compute as pc
    >>> arr1 = pa.array([1, 1, 2, 2, 3, 2, 2, 2])
    >>> pc.max(arr1)
    <pyarrow.Int64Scalar: 3>

    Using ``skip_nulls`` to handle null values.

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

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

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

    This function also works with string values.

    >>> arr4 = pa.array(["z", None, "y", "x"])
    >>> pc.max(arr4)
    <pyarrow.StringScalar: 'z'>
    """

function_doc_additions["min_max"] = """