pandas.Series.reindex
pandas 3.1.1 · Series and accessors · method
Conform to supplied labels and fill positions where those labels did not previously exist.
Call syntax
Series.reindex(…) Full signature
Series.reindex(
index=None,
*,
axis=None,
method=None,
copy=…,
level=None,
fill_value=None,
limit=None,
tolerance=None,
)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
index |
Optional Positional or keyword Default None |
scalar, list-like, dict-like or function Supply row labels or control how existing row labels are used. |
axis |
Optional Keyword only Default None |
{0 or 'index'} Choose which axis the operation acts on. The accepted axis labels depend on the receiver. |
method |
Optional Keyword only Default None |
{None, 'backfill'/'bfill', 'pad'/'ffill', 'nearest'} Choose the algorithm used to calculate, align, or fill the result. |
copy |
Optional Keyword only |
bool Control whether data is copied where the API supports that choice. |
level |
Optional Keyword only Default None |
int or name Choose an index level by name or integer position. |
fill_value |
Optional Keyword only Default None |
scalar Supply a value to use in place of a missing position. |
limit |
Optional Keyword only Default None |
int Set a maximum number of items affected by the operation. |
tolerance |
Optional Keyword only Default None |
Set the maximum acceptable distance for an inexact match. |
Returns
Series