Generic row-wise reductions. Parameters ---------- chunk : callable Function to operate on each partition. Should return a ``pandas.DataFrame``, ``pandas.Series``, or a scalar. aggregate : callable, optional Function to operate on
(
self,
chunk,
aggregate=None,
combine=None,
meta=no_default,
token=None,
split_every=None,
chunk_kwargs=None,
aggregate_kwargs=None,
combine_kwargs=None,
**kwargs,
)
| 2164 | return new_collection(self.expr.cummin(skipna=skipna)) |
| 2165 | |
| 2166 | def reduction( |
| 2167 | self, |
| 2168 | chunk, |
| 2169 | aggregate=None, |
| 2170 | combine=None, |
| 2171 | meta=no_default, |
| 2172 | token=None, |
| 2173 | split_every=None, |
| 2174 | chunk_kwargs=None, |
| 2175 | aggregate_kwargs=None, |
| 2176 | combine_kwargs=None, |
| 2177 | **kwargs, |
| 2178 | ): |
| 2179 | """Generic row-wise reductions. |
| 2180 | |
| 2181 | Parameters |
| 2182 | ---------- |
| 2183 | chunk : callable |
| 2184 | Function to operate on each partition. Should return a |
| 2185 | ``pandas.DataFrame``, ``pandas.Series``, or a scalar. |
| 2186 | aggregate : callable, optional |
| 2187 | Function to operate on the concatenated result of ``chunk``. If not |
| 2188 | specified, defaults to ``chunk``. Used to do the final aggregation |
| 2189 | in a tree reduction. |
| 2190 | |
| 2191 | The input to ``aggregate`` depends on the output of ``chunk``. |
| 2192 | If the output of ``chunk`` is a: |
| 2193 | |
| 2194 | - scalar: Input is a Series, with one row per partition. |
| 2195 | - Series: Input is a DataFrame, with one row per partition. Columns |
| 2196 | are the rows in the output series. |
| 2197 | - DataFrame: Input is a DataFrame, with one row per partition. |
| 2198 | Columns are the columns in the output dataframes. |
| 2199 | |
| 2200 | Should return a ``pandas.DataFrame``, ``pandas.Series``, or a |
| 2201 | scalar. |
| 2202 | combine : callable, optional |
| 2203 | Function to operate on intermediate concatenated results of |
| 2204 | ``chunk`` in a tree-reduction. If not provided, defaults to |
| 2205 | ``aggregate``. The input/output requirements should match that of |
| 2206 | ``aggregate`` described above. |
| 2207 | $META |
| 2208 | token : str, optional |
| 2209 | The name to use for the output keys. |
| 2210 | split_every : int, optional |
| 2211 | Group partitions into groups of this size while performing a |
| 2212 | tree-reduction. If set to False, no tree-reduction will be used, |
| 2213 | and all intermediates will be concatenated and passed to |
| 2214 | ``aggregate``. Default is 8. |
| 2215 | chunk_kwargs : dict, optional |
| 2216 | Keyword arguments to pass on to ``chunk`` only. |
| 2217 | aggregate_kwargs : dict, optional |
| 2218 | Keyword arguments to pass on to ``aggregate`` only. |
| 2219 | combine_kwargs : dict, optional |
| 2220 | Keyword arguments to pass on to ``combine`` only. |
| 2221 | kwargs : |
| 2222 | All remaining keywords will be passed to ``chunk``, ``combine``, |
| 2223 | and ``aggregate``. |