pandas.api.extensions.ExtensionArray.fillna#

ExtensionArray.fillna(value, limit=None, copy=True)[source]#

Fill NA/NaN values using the specified method.

Parameters:
valuescalar, array-like

If a scalar value is passed it is used to fill all missing values. Alternatively, an array-like “value” can be given. It’s expected that the array-like have the same length as ‘self’.

limitint, default None

The maximum number of entries where NA values will be filled.

copybool, default True

Whether to make a copy of the data before filling. If False, then the original should be modified and no new memory should be allocated. For ExtensionArray subclasses that cannot do this, it is at the author’s discretion whether to ignore “copy=False” or to raise.

Returns:
ExtensionArray

With NA/NaN filled.

See also

api.extensions.ExtensionArray.dropna

Return ExtensionArray without NA values.

api.extensions.ExtensionArray.isna

A 1-D array indicating if each value is missing.

Examples

>>> arr = pd.array([np.nan, np.nan, 2, 3, np.nan, np.nan])
>>> arr.fillna(0)
<IntegerArray>
[0, 0, 2, 3, 0, 0]
Length: 6, dtype: Int64