Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
znicholls committed Oct 13, 2023
1 parent 82fe92c commit 5071737
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
6 changes: 6 additions & 0 deletions docs/source/api/scmdata.groupby.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ RunGroupBy

.. autoclass:: RunGroupBy
:members:


get\_joblib\_parallel\_processor
================================

.. autofunction:: get_joblib_parallel_processor
29 changes: 15 additions & 14 deletions src/scmdata/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ def apply(
"""
Apply a function to each group and append the results
`func` is called like `func(ar, *args, **kwargs)` for each :class:`ScmRun <scmdata.run.ScmRun>` ``ar``
in this group. If the result of this function call is None, than it is
`func` is called like `func(ar, *args, **kwargs)` for each :class:`ScmRun <scmdata.run.ScmRun>`
group. If the result of this function call is ``None``, than it is
excluded from the results.
The results are appended together using :func:`run_append`. The function
can change the size of the input :class:`ScmRun <scmdata.run.ScmRun>` as long as :func:`run_append`
can be applied to all results.
can change the size of the input :class:`ScmRun <scmdata.run.ScmRun>`
as long as :func:`run_append` can be applied to all results.
Examples
--------
Expand All @@ -123,18 +123,17 @@ def apply(
Parameters
----------
func
Callable to apply to each timeseries.
Callable to apply to each group.
``*args``
*args
Positional arguments passed to `func`.
``**kwargs``
Used to call `func(ar, **kwargs)` for each array `ar`.
**kwargs
Keyword arguments passed to `func`.
Returns
-------
applied : :class:`ScmRun <scmdata.run.ScmRun>`
The result of splitting, applying and combining this array.
The result of applying and combining.
"""
grouped = self._iter_grouped()
applied = [func(arr, *args, **kwargs) for arr in grouped]
Expand Down Expand Up @@ -164,18 +163,20 @@ def apply_parallel(
----------
func
Callable to apply to each group.
parallel_processor
Parallel processor to use to process the groups. If not provided,
the return value of :func:`get_joblib_parallel_processor` is used.
``*args``
*args
Positional arguments passed to `func`.
``**kwargs``
**kwargs
Keyword arguments passed to `func`.
Returns
-------
applied : :class:`ScmRun <scmdata.run.ScmRun>`
The result of splitting, applying and combining this array.
The result of applying and combining.
"""
if parallel_processor is None:
parallel_processor = get_joblib_parallel_processor()
Expand Down
4 changes: 2 additions & 2 deletions src/scmdata/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1982,10 +1982,10 @@ def apply(
func : function
Callable to apply to each timeseries.
``*args``
*args
Positional arguments passed to `func`.
``**kwargs``
**kwargs
Used to call `func(ar, **kwargs)` for each array `ar`.
Returns
Expand Down

0 comments on commit 5071737

Please sign in to comment.