pandas.MultiIndex.truncate

pandas 3.1.1 · Index objects · method

Keep labels within specified before and after bounds on a sorted axis.

Call syntax

MultiIndex.truncate(before=None, after=None)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
before Optional
Positional or keyword
Default None
label or tuple, can be partial. Default None

Set the earliest retained label for truncation.

after Optional
Positional or keyword
Default None
label or tuple, can be partial. Default None

Set the latest retained label for truncation.

Returns

MultiIndex