pandas 1.4.2

ParametersReturns
__getitem__(self, arg: 'PositionalIndexer | tuple') -> 'DataFrame | Series'

Implements GroupBy._positional_selector

Parameters

arg : PositionalIndexer | tuple

Allowed values are: - int - int valued iterable such as list or range - slice with step either None or positive - tuple of integers and slices

Returns

Series

The filtered subset of the original groupby Series.

DataFrame

The filtered subset of the original groupby DataFrame.

Select by positional index per group.

See Also

DataFrame.iloc

Integer-location based indexing for selection by position.

GroupBy._positional_selector

Return positional selection for each group.

GroupBy.head

Return first n rows of each group.

GroupBy.nth

Take the nth row from each group if n is an int, or a subset of rows, if n is a list of ints.

GroupBy.tail

Return last n rows of each group.

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