pandas 1.4.2

ParametersReturns
_ensure_key_mapped_multiindex(index: 'MultiIndex', key: 'Callable', level=None) -> 'MultiIndex'

Parameters

index : MultiIndex

Index to which to apply the key function on the specified levels.

key : Callable

Function that takes an Index and returns an Index of the same shape. This key is applied to each level separately. The name of the level can be used to distinguish different levels for application.

level : list-like, int or str, default None

Level or list of levels to apply the key function to. If None, key function is applied to all levels. Other levels are left unchanged.

Returns

labels : MultiIndex

Resulting MultiIndex with modified levels.

Returns a new MultiIndex in which key has been applied to all levels specified in level (or all levels if level is None). Used for key sorting for MultiIndex.

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