MCPcopy Create free account
hub / github.com/dask/dask / _aggregate_docstring

Function _aggregate_docstring

dask/dataframe/groupby.py:1158–1210  ·  view source on GitHub ↗
(based_on=None)

Source from the content-addressed store, hash-verified

1156
1157
1158def _aggregate_docstring(based_on=None):
1159 # Insert common groupby-aggregation docstring.
1160 # Use `based_on` parameter to add note about the
1161 # Pandas method the Dask version is based on.
1162 based_on_str = "\n" if based_on is None else f"\nBased on {based_on}\n"
1163
1164 def wrapper(func):
1165 func.__doc__ = f"""Aggregate using one or more specified operations
1166 {based_on_str}
1167 Parameters
1168 ----------
1169 arg : callable, str, list or dict, optional
1170 Aggregation spec. Accepted combinations are:
1171
1172 - callable function
1173 - string function name
1174 - list of functions and/or function names, e.g. ``[np.sum, 'mean']``
1175 - dict of column names -> function, function name or list of such.
1176 - None only if named aggregation syntax is used
1177 split_every : int >= 2 or dict(axis: int), optional
1178 Number of intermediate partitions that may be aggregated at once.
1179 This defaults to 8.
1180 Determines the depth of the recursive aggregation. If set to or more
1181 than the number of input chunks, the aggregation will be performed in
1182 two steps, one ``chunk`` function per input chunk and a single
1183 ``aggregate`` function at the end. If set to less than that, an
1184 intermediate ``combine`` function will be used, so that any one
1185 ``combine`` or ``aggregate`` function has no more than ``split_every``
1186 inputs. The depth of the aggregation graph will be
1187 :math:`\\log_\\text{{split_every}}(\\text{{input chunks along reduced axes}})`.
1188 Setting to a low value can reduce cache size and network transfers, at
1189 the cost of more CPU and a larger dask graph.
1190 split_out : int, optional
1191 Number of output results in group-by like aggregations (defaults to 1)
1192 shuffle : bool or str, optional
1193 Whether a shuffle-based algorithm should be used. A specific
1194 algorithm name may also be specified (e.g. ``"tasks"`` or ``"p2p"``).
1195 The shuffle-based algorithm is likely to be more efficient than
1196 ``shuffle=False`` when ``split_out>1`` and the number of unique
1197 groups is large (high cardinality). Default is ``False`` when
1198 ``split_out = 1``. When ``split_out > 1``, it chooses the algorithm
1199 set by the ``shuffle`` option in the dask config system, or ``"tasks"``
1200 if nothing is set.
1201 kwargs: tuple or pd.NamedAgg, optional
1202 Used for named aggregations where the keywords are the output column
1203 names and the values are tuples where the first element is the input
1204 column name and the second element is the aggregation function.
1205 ``pandas.NamedAgg`` can also be used as the value. To use the named
1206 aggregation syntax, arg must be set to None.
1207 """
1208 return func
1209
1210 return wrapper
1211
1212
1213def _unique_aggregate(series_gb, name=None):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected