Fill NA/NaN values with the specified value.
Scalar value to use to fill holes (e.g. 0). This value cannot be a list-likes.
A dict of item->dtype of what to downcast if possible, or the string ‘infer’ which will try to downcast to an appropriate equal type (e.g. float64 to int64 if possible).
Deprecated since version 2.1.0.
See also
DataFrame.fillnaFill NaN values of a DataFrame.
Series.fillnaFill NaN Values of a Series.
Examples
>>> idx = pd.Index([np.nan, np.nan, 3])
>>> idx.fillna(0)
Index([0.0, 0.0, 3.0], dtype='float64')
© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.Index.fillna.html