From bd56eb54fb7ca1bf83630529166f3df763fe37ea Mon Sep 17 00:00:00 2001 From: Ruifeng Zheng Date: Fri, 13 Feb 2026 11:41:28 +0800 Subject: [PATCH 1/2] test --- python/pyarrow/_compute_docstrings.py | 84 +++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/python/pyarrow/_compute_docstrings.py b/python/pyarrow/_compute_docstrings.py index 4b690dd1c57..6322dd081c6 100644 --- a/python/pyarrow/_compute_docstrings.py +++ b/python/pyarrow/_compute_docstrings.py @@ -156,3 +156,87 @@ >>> pc.min_max(arr4) """ + +function_doc_additions["first"] = """ + Examples + -------- + >>> import pyarrow as pa + >>> import pyarrow.compute as pc + >>> arr1 = pa.array([1, 1, 2, 2, 3, 2, 2, 2]) + >>> pc.first(arr1) + + + Using ``skip_nulls`` to handle null values. + + >>> arr2 = pa.array([None, 1.0, 2.0, 3.0]) + >>> pc.first(arr2) + + >>> pc.first(arr2, skip_nulls=False) + + + Using ``ScalarAggregateOptions`` to control minimum number of non-null values. + + >>> arr3 = pa.array([1.0, None, float("nan"), 3.0]) + >>> pc.first(arr3) + + >>> pc.first(arr3, options=pc.ScalarAggregateOptions(min_count=3)) + + >>> pc.first(arr3, options=pc.ScalarAggregateOptions(min_count=4)) + + """ + +function_doc_additions["last"] = """ + Examples + -------- + >>> import pyarrow as pa + >>> import pyarrow.compute as pc + >>> arr1 = pa.array([1, 1, 2, 2, 3, 2, 2, 2]) + >>> pc.last(arr1) + + + Using ``skip_nulls`` to handle null values. + + >>> arr2 = pa.array([1.0, 2.0, 3.0, None]) + >>> pc.last(arr2) + + >>> pc.last(arr2, skip_nulls=False) + + + Using ``ScalarAggregateOptions`` to control minimum number of non-null values. + + >>> arr3 = pa.array([1.0, None, float("nan"), 3.0]) + >>> pc.last(arr3) + + >>> pc.last(arr3, options=pc.ScalarAggregateOptions(min_count=3)) + + >>> pc.last(arr3, options=pc.ScalarAggregateOptions(min_count=4)) + + """ + +function_doc_additions["first_last"] = """ + Examples + -------- + >>> import pyarrow as pa + >>> import pyarrow.compute as pc + >>> arr1 = pa.array([1, 1, 2, 2, 3, 2, 2, 2]) + >>> pc.first_last(arr1) + + + Using ``skip_nulls`` to handle null values. + + >>> arr2 = pa.array([1.0, 2.0, 3.0, None]) + >>> pc.first_last(arr2) + + >>> pc.first_last(arr2, skip_nulls=False) + + + Using ``ScalarAggregateOptions`` to control minimum number of non-null values. + + >>> arr3 = pa.array([1.0, None, float("nan"), 3.0]) + >>> pc.first_last(arr3) + + >>> pc.first_last(arr3, options=pc.ScalarAggregateOptions(min_count=3)) + + >>> pc.first_last(arr3, options=pc.ScalarAggregateOptions(min_count=4)) + + """ From 2491b6b4577113305fa8ba03535d9c4d526752d1 Mon Sep 17 00:00:00 2001 From: Ruifeng Zheng Date: Fri, 13 Feb 2026 12:22:06 +0800 Subject: [PATCH 2/2] test --- python/pyarrow/_compute_docstrings.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/python/pyarrow/_compute_docstrings.py b/python/pyarrow/_compute_docstrings.py index 6322dd081c6..ed0dcc2cd9b 100644 --- a/python/pyarrow/_compute_docstrings.py +++ b/python/pyarrow/_compute_docstrings.py @@ -183,6 +183,11 @@ >>> pc.first(arr3, options=pc.ScalarAggregateOptions(min_count=4)) + + See Also + -------- + pyarrow.compute.first_last + pyarrow.compute.last """ function_doc_additions["last"] = """ @@ -211,6 +216,11 @@ >>> pc.last(arr3, options=pc.ScalarAggregateOptions(min_count=4)) + + See Also + -------- + pyarrow.compute.first + pyarrow.compute.first_last """ function_doc_additions["first_last"] = """ @@ -239,4 +249,9 @@ >>> pc.first_last(arr3, options=pc.ScalarAggregateOptions(min_count=4)) + + See Also + -------- + pyarrow.compute.first + pyarrow.compute.last """