pandas.Index.reindex

pandas 3.1.1 · Index objects · method

Return the target index together with positions that map it to the current index.

Call syntax

Index.reindex(target, method=None, level=None, limit=None, tolerance=None)

Run the example

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

Parameters

ParameterRequirementAccepted values and behavior
target Required
Positional or keyword
an iterable

Supply the labels to align or match against.

method Optional
Positional or keyword
Default None
{None, 'pad'/'ffill', 'backfill'/'bfill', 'nearest'}

Choose the algorithm used to calculate, align, or fill the result.

level Optional
Positional or keyword
Default None
int

Choose an index level by name or integer position.

limit Optional
Positional or keyword
Default None
int

Set a maximum number of items affected by the operation.

tolerance Optional
Positional or keyword
Default None
int, float, or list-like

Set the maximum acceptable distance for an inexact match.

Returns

new_index · pd.Index; indexer · np.ndarray[np.intp] or None