pandas 1.4.2

ParametersReturnsBackRef
reconstruct_func(func: 'AggFuncType | None', **kwargs) -> 'tuple[bool, AggFuncType | None, list[str] | None, list[int] | None]'

If named aggregation is applied, func will be None, and kwargs contains the column and aggregation function information to be parsed; If named aggregation is not applied, func is either string (e.g. 'min') or Callable, or list of them (e.g. ['min', np.max]), or the dictionary of column name and str/Callable/list of them (e.g. {'A': 'min'}, or {'A': [np.min, lambda x: x]})

If relabeling is True, will return relabeling, reconstructed func, column names, and the reconstructed order of columns. If relabeling is False, the columns and order will be None.

Parameters

func: agg function (e.g. 'min' or Callable) or list of agg functions :

(e.g. ['min', np.max]) or dictionary (e.g. {'A': ['min', np.max]}).

**kwargs: dict, kwargs used in is_multi_agg_with_relabel and :

normalize_keyword_aggregation function for relabelling

Returns

relabelling: bool, if there is relabelling or not
func: normalized and mangled func
columns: list of column names
order: list of columns indices

This is the internal function to reconstruct func given if there is relabeling or not and also normalize the keyword to get new order of columns.

Examples

This example is valid syntax, but we were not able to check execution
>>> reconstruct_func(None, **{"foo": ("col", "min")})
(True, defaultdict(<class 'list'>, {'col': ['min']}), ('foo',), array([0]))
This example is valid syntax, but we were not able to check execution
>>> reconstruct_func("min")
(False, 'min', None, None)
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

pandas.core.apply.reconstruct_func

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/apply.py#1206
type: <class 'function'>
Commit: