Skip to content

Conversation

@pitrou
Copy link
Member

@pitrou pitrou commented Jun 23, 2021

Generate a signature for compute functions that better reflects the accepted arguments.

Example before:

>>> pc.sum?
Signature: pc.sum(array, *, options=None, memory_pool=None, **kwargs)
Docstring:
Compute the sum of a numeric array.
[...]

Same example after:

>>> ?pc.sum
Signature:
pc.sum(
    array,
    *,
    memory_pool=None,
    options=None,
    skip_nulls=True,
    min_count=1,
)
Docstring:
Compute the sum of a numeric array.
[...]

One caveat is that the individual options are not explicitly documented (yet):

Parameters
----------
array : Array-like
    Argument to compute function
memory_pool : pyarrow.MemoryPool, optional
    If not passed, will allocate memory from the default memory pool.
options : pyarrow.compute.ScalarAggregateOptions, optional
    Parameters altering compute function semantics
**kwargs : optional
    Parameters for ScalarAggregateOptions constructor. Either `options`
    or `**kwargs` can be passed, but not both at the same time.

@github-actions
Copy link

@pitrou
Copy link
Member Author

pitrou commented Jun 23, 2021

@amol- Do you want to review this?

@pitrou
Copy link
Member Author

pitrou commented Jun 30, 2021

Ping @amol-

Copy link
Member

@bkietz bkietz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one nit:

@pitrou pitrou force-pushed the ARROW-10316-wrapped-compute-func branch 2 times, most recently from c224729 to 61459cf Compare July 1, 2021 14:59
Generate a signature for compute functions that better reflects the accepted arguments.

Example before:
```
>>> pc.sum?
Signature: pc.sum(array, *, options=None, memory_pool=None, **kwargs)
Docstring:
Compute the sum of a numeric array.
[...]
```

Same example after:
```
>>> ?pc.sum
Signature:
pc.sum(
    array,
    *,
    memory_pool=None,
    options=None,
    skip_nulls=True,
    min_count=1,
)
Docstring:
Compute the sum of a numeric array.
[...]
```

One caveat is that the individual options are not explicitly documented (yet):
```
Parameters
----------
array : Array-like
    Argument to compute function
memory_pool : pyarrow.MemoryPool, optional
    If not passed, will allocate memory from the default memory pool.
options : pyarrow.compute.ScalarAggregateOptions, optional
    Parameters altering compute function semantics
**kwargs : optional
    Parameters for ScalarAggregateOptions constructor. Either `options`
    or `**kwargs` can be passed, but not both at the same time.
```
@pitrou pitrou force-pushed the ARROW-10316-wrapped-compute-func branch from 61459cf to b07b223 Compare July 1, 2021 14:59
@pitrou
Copy link
Member Author

pitrou commented Jul 1, 2021

Will merge now. Thank you for the reviews!

@pitrou pitrou closed this in 5600536 Jul 1, 2021
@pitrou pitrou deleted the ARROW-10316-wrapped-compute-func branch July 1, 2021 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants