pandas 1.4.2

ParametersReturns
_reindex_output(self, output: 'OutputFrameOrSeries', fill_value: 'Scalar' = nan, qs: 'npt.NDArray[np.float64] | None' = None) -> 'OutputFrameOrSeries'

The method returns early without modifying the input if the number of groupings is less than 2, self.observed == True or none of the groupers are categorical.

Parameters

output : Series or DataFrame

Object resulting from grouping and applying an operation.

fill_value : scalar, default np.NaN

Value to use for unobserved categories if self.observed is False.

qs : np.ndarray[float64] or None, default None

quantile values, only relevant for quantile.

Returns

Series or DataFrame

Object (potentially) re-indexed to include all possible groups.

If we have categorical groupers, then we might want to make sure that we have a fully re-indexed output to the levels. This means expanding the output space to accommodate all values in the cartesian product of our groups, regardless of whether they were observed in the data or not. This will expand the output space if there are missing groups.

Examples

See :

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/groupby/groupby.py#3593
type: <class 'function'>
Commit: