def fillna(self, value=None, method=None, axis=None, inplace=False,<EOL>limit=None, downcast=None):
inplace = validate_bool_kwarg(inplace, '<STR_LIT>')<EOL>value, method = validate_fillna_kwargs(value, method)<EOL>self._consolidate_inplace()<EOL>if axis is None:<EOL><INDENT>axis = <NUM_LIT:0><EOL><DEDENT>axis = self._get_axis_number(axis)<EOL>from pandas import DataFrame<EOL>if value is None:<EOL><INDENT>if self._is_mixed_type and axis == <NUM_LIT:1>:<EOL><INDENT>if inplace:<EOL><INDENT>raise NotImplementedError()<EOL><DEDENT>result = self.T.fillna(method=method, limit=limit).T<EOL>result._data = result._data.downcast()<EOL>return result<EOL><DEDENT>if self.ndim > <NUM_LIT:3>:<EOL><INDENT>raise NotImplementedError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>elif self.ndim == <NUM_LIT:3>:<EOL><INDENT>result = {col: s.fillna(method=method, value=value)<EOL>for col, s in self.iteritems()}<EOL>prelim_obj = self._constructor.from_dict(result)<EOL>new_obj = prelim_obj.__finalize__(self)<EOL>new_data = new_obj._data<EOL><DEDENT>else:<EOL><INDENT>new_data = self._data.interpolate(method=method, axis=axis,<EOL>limit=limit, inplace=inplace,<EOL>coerce=True,<EOL>downcast=downcast)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if len(self._get_axis(axis)) == <NUM_LIT:0>:<EOL><INDENT>return self<EOL><DEDENT>if self.ndim == <NUM_LIT:1>:<EOL><INDENT>if isinstance(value, (dict, ABCSeries)):<EOL><INDENT>from pandas import Series<EOL>value = Series(value)<EOL><DEDENT>elif not is_list_like(value):<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(type(value).__name__))<EOL><DEDENT>new_data = self._data.fillna(value=value, limit=limit,<EOL>inplace=inplace,<EOL>downcast=downcast)<EOL><DEDENT>elif isinstance(value, (dict, ABCSeries)):<EOL><INDENT>if axis == <NUM_LIT:1>:<EOL><INDENT>raise NotImplementedError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>result = self if inplace else self.copy()<EOL>for k, v in value.items():<EOL><INDENT>if k not in result:<EOL><INDENT>continue<EOL><DEDENT>obj = result[k]<EOL>obj.fillna(v, limit=limit, inplace=True, downcast=downcast)<EOL><DEDENT>return result if not inplace else None<EOL><DEDENT>elif not is_list_like(value):<EOL><INDENT>new_data = self._data.fillna(value=value, limit=limit,<EOL>inplace=inplace,<EOL>downcast=downcast)<EOL><DEDENT>elif isinstance(value, DataFrame) and self.ndim == <NUM_LIT:2>:<EOL><INDENT>new_data = self.where(self.notna(), value)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % type(value))<EOL><DEDENT><DEDENT>if inplace:<EOL><INDENT>self._update_inplace(new_data)<EOL><DEDENT>else:<EOL><INDENT>return self._constructor(new_data).__finalize__(self)<EOL><DEDENT>
Fill NA/NaN values using the specified method.

Parameters
----------
value : scalar, dict, Series, or DataFrame
    Value to use to fill holes (e.g. 0), alternately a
    dict/Series/DataFrame of values specifying which value to use for
    each index (for a Series) or column (for a DataFrame).  Values not
    in the dict/Series/DataFrame will not be filled. This value cannot
    be a list.
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.
axis : %(axes_single_arg)s
    Axis along which to fill missing values.
inplace : bool, default False
    If True, fill in-place. Note: this will modify any
    other views on this object (e.g., a no-copy slice for a column in a
    DataFrame).
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. Must be greater than 0 if not None.
downcast : dict, default is None
    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).

Returns
-------
%(klass)s
    Object with missing values filled.

See Also
--------
interpolate : Fill NaN values using interpolation.
reindex : Conform object to new index.
asfreq : Convert TimeSeries to specified frequency.

Examples
--------
>>> df = pd.DataFrame([[np.nan, 2, np.nan, 0],
...                    [3, 4, np.nan, 1],
...                    [np.nan, np.nan, np.nan, 5],
...                    [np.nan, 3, np.nan, 4]],
...                   columns=list('ABCD'))
>>> df
     A    B   C  D
0  NaN  2.0 NaN  0
1  3.0  4.0 NaN  1
2  NaN  NaN NaN  5
3  NaN  3.0 NaN  4

Replace all NaN elements with 0s.

>>> df.fillna(0)
    A   B   C   D
0   0.0 2.0 0.0 0
1   3.0 4.0 0.0 1
2   0.0 0.0 0.0 5
3   0.0 3.0 0.0 4

We can also propagate non-null values forward or backward.

>>> df.fillna(method='ffill')
    A   B   C   D
0   NaN 2.0 NaN 0
1   3.0 4.0 NaN 1
2   3.0 4.0 NaN 5
3   3.0 3.0 NaN 4

Replace all NaN elements in column 'A', 'B', 'C', and 'D', with 0, 1,
2, and 3 respectively.

>>> values = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
>>> df.fillna(value=values)
    A   B   C   D
0   0.0 2.0 2.0 0
1   3.0 4.0 2.0 1
2   0.0 1.0 2.0 5
3   0.0 3.0 2.0 4

Only replace the first NaN element.

>>> df.fillna(value=values, limit=1)
    A   B   C   D
0   0.0 2.0 2.0 0
1   3.0 4.0 NaN 1
2   NaN 1.0 NaN 5
3   NaN 3.0 NaN 4