def fillna(self, value=None, method=None, limit=None):
from pandas.api.types import is_array_like<EOL>from pandas.util._validators import validate_fillna_kwargs<EOL>from pandas.core.missing import pad_1d, backfill_1d<EOL>value, method = validate_fillna_kwargs(value, method)<EOL>mask = self.isna()<EOL>if is_array_like(value):<EOL><INDENT>if len(value) != len(self):<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>".format(len(value), len(self)))<EOL><DEDENT>value = value[mask]<EOL><DEDENT>if mask.any():<EOL><INDENT>if method is not None:<EOL><INDENT>func = pad_1d if method == '<STR_LIT>' else backfill_1d<EOL>new_values = func(self.astype(object), limit=limit,<EOL>mask=mask)<EOL>new_values = self._from_sequence(new_values, dtype=self.dtype)<EOL><DEDENT>else:<EOL><INDENT>new_values = self.copy()<EOL>new_values[mask] = value<EOL><DEDENT><DEDENT>else:<EOL><INDENT>new_values = self.copy()<EOL><DEDENT>return new_values<EOL>
Fill NA/NaN values using the specified method.

Parameters
----------
value : scalar, 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'.
method : {'backfill', 'bfill', 'pad', 'ffill', None}, default None
    Method to use for filling holes in reindexed Series
    pad / ffill: propagate last valid observation forward to next valid
    backfill / bfill: use NEXT valid observation to fill gap
limit : int, default None
    If method is specified, this is the maximum number of consecutive
    NaN values to forward/backward fill. In other words, if there is
    a gap with more than this number of consecutive NaNs, it will only
    be partially filled. If method is not specified, this is the
    maximum number of entries along the entire axis where NaNs will be
    filled.

Returns
-------
filled : ExtensionArray with NA/NaN filled