5 Commits
Author SHA1 Message Date
f3b46fb7d4 GH-49677 [Python][C++][Compute] Add search sorted compute kernel (#49679)
### Rationale for this change
Add the implemenation of the search sorted compute kernel based on the numpy function: https://numpy.org/doc/stable/reference/generated/numpy.searchsorted.html

### What changes are included in this PR?
Implementation of the C++ kernel + Python API.
Tests in C++ and Python

### Are these changes tested?
Yes

### Are there any user-facing changes?
No breaking change

* GitHub Issue: #49677

Lead-authored-by: Alexis Placet <2400067+Alex-PLACET@users.noreply.github.com>
Co-authored-by: Alexis Placet <alexis.placet.dev@pm.me>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Co-authored-by: Copilot <copilot@github.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2026-09-21 12:35:41 +02:00
Ruifeng Zheng bf8d1754c9 GH-49269: [Python][Docs] Add code examples for compute function first/last/first_last (#49270)
### Rationale for this change
To improve python documentation

### What changes are included in this PR?
Add code examples for compute function first/last/first_last

### Are these changes tested?
Yes, doc-test

### Are there any user-facing changes?
Yes, doc-only changes

* GitHub Issue: #49269

Authored-by: Ruifeng Zheng <ruifengz@apache.org>
Signed-off-by: AlenkaF <frim.alenka@gmail.com>
2026-03-05 13:12:49 +01:00
Ruifeng ZhengandAlenka Frim 8995d61c07 GH-48668: [Python][Docs] Add python examples for compute functions min/max/min_max (#48648)
### Rationale for this change
To improve python documentation

### What changes are included in this PR?
Add python examples for compute functions `min/max/min_max`

### Are these changes tested?
Yes, doc-test

### Are there any user-facing changes?
Doc-only changes

* GitHub Issue: #48668

Lead-authored-by: Ruifeng Zheng <ruifengz@apache.org>
Co-authored-by: Ruifeng Zheng <ruifengz@foxmail.com>
Co-authored-by: Alenka Frim <AlenkaF@users.noreply.github.com>
Signed-off-by: AlenkaF <frim.alenka@gmail.com>
2026-01-12 08:41:15 +01:00
Alenka FrimandAlenka Frim 3b92f0279d ARROW-16018: [Doc][Python] Run doctests on Python docstring examples (--doctest-modules)
A series of 3 PRs add `doctest` functionality to ensure that docstring examples are actually correct (and keep being correct).

- [x] Add `--doctest-module`
- [x] Add `--doctest-cython` https://github.com/apache/arrow/pull/13204
- [x] Create a CI job https://github.com/apache/arrow/pull/13216

This PR can be tested with `pytest --doctest-modules python/pyarrow`.

Closes #13199 from AlenkaF/ARROW-16018

Lead-authored-by: Alenka Frim <frim.alenka@gmail.com>
Co-authored-by: Alenka Frim <AlenkaF@users.noreply.github.com>
Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
2022-05-25 12:55:15 +02:00
Antoine Pitrou 81c8a0e06b ARROW-10209: [Python] Support positional options in compute functions
This makes compute functions easier to use, for example here the required "pattern" option doesn't need to be passed by name:
```
>>> pc.split_pattern("abacab", "a")
<pyarrow.ListScalar: ['', 'b', 'c', 'b']>
```

... and producing the following doc at the prompt:
```
split_pattern(strings, /, pattern, *, max_splits=-1, reverse=False, options=None, memory_pool=None)
    Split string according to separator.

    Split each string according to the exact `pattern` defined in
    SplitPatternOptions.  The output for each string input is a list
    of strings.

    The maximum number of splits and direction of splitting
    (forward, reverse) can optionally be defined in SplitPatternOptions.

    Parameters
    ----------
    strings : Array-like or scalar-like
        Argument to compute function
    pattern : optional
        Parameter for SplitPatternOptions constructor. Either `options`
        or `pattern` can be passed, but not both at the same time.
    max_splits : optional
        Parameter for SplitPatternOptions constructor. Either `options`
        or `max_splits` can be passed, but not both at the same time.
    reverse : optional
        Parameter for SplitPatternOptions constructor. Either `options`
        or `reverse` can be passed, but not both at the same time.
    options : pyarrow.compute.SplitPatternOptions, optional
        Parameters altering compute function semantics.
    memory_pool : pyarrow.MemoryPool, optional
        If not passed, will allocate memory from the default memory pool.
```

Closes #11955 from pitrou/ARROW-10209-compute-pos-args

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2021-12-16 19:49:10 +01:00