cudf.Series.reindex#

Series.reindex(index=None, *, axis=None, method: str | None = None, copy: bool = True, level=None, fill_value: ScalarLike | None = None, limit: int | None = None, tolerance=None)[source]#

Conform Series to new index.

Parameters:
indexIndex, Series-convertible, default None

New labels / index to conform to, should be specified using keywords.

axis: int, default None

Unused.

method: Not Supported
copyboolean, default True
level: Not Supported
fill_valueValue to use for missing values.

Defaults to NA, but can be any “compatible” value.

limit: Not Supported
tolerance: Not Supported
Returns:
Series with changed index.

Examples

>>> import cudf
>>> series = cudf.Series([10, 20, 30, 40], index=['a', 'b', 'c', 'd'])
>>> series
a    10
b    20
c    30
d    40
dtype: int64
>>> series.reindex(['a', 'b', 'y', 'z'])
a      10
b      20
y    <NA>
z    <NA>
dtype: int64

Pandas Compatibility Note

pandas.Series.reindex()

Note: One difference from Pandas is that NA is used for rows that do not match, rather than NaN. One side effect of this is that the series retains an integer dtype in cuDF where it is cast to float in Pandas.