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,
)
| 2130 | return new_collection(self.expr.cummin(skipna=skipna)) |
| 2131 | |
| 2132 | def reduction( |
| 2133 | self, |
| 2134 | chunk, |
| 2135 | aggregate=None, |
| 2136 | combine=None, |
| 2137 | meta=no_default, |
| 2138 | token=None, |
| 2139 | split_every=None, |
| 2140 | chunk_kwargs=None, |
| 2141 | aggregate_kwargs=None, |
| 2142 | combine_kwargs=None, |
| 2143 | **kwargs, |
| 2144 | ): |
| 2145 | """Generic row-wise reductions. |
| 2146 | |
| 2147 | Parameters |
| 2148 | ---------- |
| 2149 | chunk : callable |
| 2150 | Function to operate on each partition. Should return a |
| 2151 | ``pandas.DataFrame``, ``pandas.Series``, or a scalar. |
| 2152 | aggregate : callable, optional |
| 2153 | Function to operate on the concatenated result of ``chunk``. If not |
| 2154 | specified, defaults to ``chunk``. Used to do the final aggregation |
| 2155 | in a tree reduction. |
| 2156 | |
| 2157 | The input to ``aggregate`` depends on the output of ``chunk``. |
| 2158 | If the output of ``chunk`` is a: |
| 2159 | |
| 2160 | - scalar: Input is a Series, with one row per partition. |
| 2161 | - Series: Input is a DataFrame, with one row per partition. Columns |
| 2162 | are the rows in the output series. |
| 2163 | - DataFrame: Input is a DataFrame, with one row per partition. |
| 2164 | Columns are the columns in the output dataframes. |
| 2165 | |
| 2166 | Should return a ``pandas.DataFrame``, ``pandas.Series``, or a |
| 2167 | scalar. |
| 2168 | combine : callable, optional |
| 2169 | Function to operate on intermediate concatenated results of |
| 2170 | ``chunk`` in a tree-reduction. If not provided, defaults to |
| 2171 | ``aggregate``. The input/output requirements should match that of |
| 2172 | ``aggregate`` described above. |
| 2173 | $META |
| 2174 | token : str, optional |
| 2175 | The name to use for the output keys. |
| 2176 | split_every : int, optional |
| 2177 | Group partitions into groups of this size while performing a |
| 2178 | tree-reduction. If set to False, no tree-reduction will be used, |
| 2179 | and all intermediates will be concatenated and passed to |
| 2180 | ``aggregate``. Default is 8. |
| 2181 | chunk_kwargs : dict, optional |
| 2182 | Keyword arguments to pass on to ``chunk`` only. |
| 2183 | aggregate_kwargs : dict, optional |
| 2184 | Keyword arguments to pass on to ``aggregate`` only. |
| 2185 | combine_kwargs : dict, optional |
| 2186 | Keyword arguments to pass on to ``combine`` only. |
| 2187 | kwargs : |
| 2188 | All remaining keywords will be passed to ``chunk``, ``combine``, |
| 2189 | and ``aggregate``. |