def fillna(self, value=None, method=None, axis=None, inplace=False, limit=None, downcast=None):
    "\n        Fill NA/NaN values using the specified method.\n\n        Parameters\n        ----------\n        value : scalar, dict, Series, or DataFrame\n            Value to use to fill holes (e.g. 0), alternately a\n            dict/Series/DataFrame of values specifying which value to use for\n            each index (for a Series) or column (for a DataFrame).  Values not\n            in the dict/Series/DataFrame will not be filled. This value cannot\n            be a list.\n        method : {'backfill', 'bfill', 'pad', 'ffill', None}, default None\n            Method to use for filling holes in reindexed Series\n            pad / ffill: propagate last valid observation forward to next valid\n            backfill / bfill: use next valid observation to fill gap.\n        axis : %(axes_single_arg)s\n            Axis along which to fill missing values.\n        inplace : bool, default False\n            If True, fill in-place. Note: this will modify any\n            other views on this object (e.g., a no-copy slice for a column in a\n            DataFrame).\n        limit : int, default None\n            If method is specified, this is the maximum number of consecutive\n            NaN values to forward/backward fill. In other words, if there is\n            a gap with more than this number of consecutive NaNs, it will only\n            be partially filled. If method is not specified, this is the\n            maximum number of entries along the entire axis where NaNs will be\n            filled. Must be greater than 0 if not None.\n        downcast : dict, default is None\n            A dict of item->dtype of what to downcast if possible,\n            or the string 'infer' which will try to downcast to an appropriate\n            equal type (e.g. float64 to int64 if possible).\n\n        Returns\n        -------\n        %(klass)s\n            Object with missing values filled.\n\n        See Also\n        --------\n        interpolate : Fill NaN values using interpolation.\n        reindex : Conform object to new index.\n        asfreq : Convert TimeSeries to specified frequency.\n\n        Examples\n        --------\n        >>> df = pd.DataFrame([[np.nan, 2, np.nan, 0],\n        ...                    [3, 4, np.nan, 1],\n        ...                    [np.nan, np.nan, np.nan, 5],\n        ...                    [np.nan, 3, np.nan, 4]],\n        ...                   columns=list('ABCD'))\n        >>> df\n             A    B   C  D\n        0  NaN  2.0 NaN  0\n        1  3.0  4.0 NaN  1\n        2  NaN  NaN NaN  5\n        3  NaN  3.0 NaN  4\n\n        Replace all NaN elements with 0s.\n\n        >>> df.fillna(0)\n            A   B   C   D\n        0   0.0 2.0 0.0 0\n        1   3.0 4.0 0.0 1\n        2   0.0 0.0 0.0 5\n        3   0.0 3.0 0.0 4\n\n        We can also propagate non-null values forward or backward.\n\n        >>> df.fillna(method='ffill')\n            A   B   C   D\n        0   NaN 2.0 NaN 0\n        1   3.0 4.0 NaN 1\n        2   3.0 4.0 NaN 5\n        3   3.0 3.0 NaN 4\n\n        Replace all NaN elements in column 'A', 'B', 'C', and 'D', with 0, 1,\n        2, and 3 respectively.\n\n        >>> values = {'A': 0, 'B': 1, 'C': 2, 'D': 3}\n        >>> df.fillna(value=values)\n            A   B   C   D\n        0   0.0 2.0 2.0 0\n        1   3.0 4.0 2.0 1\n        2   0.0 1.0 2.0 5\n        3   0.0 3.0 2.0 4\n\n        Only replace the first NaN element.\n\n        >>> df.fillna(value=values, limit=1)\n            A   B   C   D\n        0   0.0 2.0 2.0 0\n        1   3.0 4.0 NaN 1\n        2   NaN 1.0 NaN 5\n        3   NaN 3.0 NaN 4\n        "
    inplace = validate_bool_kwarg(inplace, 'inplace')
    (value, method) = validate_fillna_kwargs(value, method)
    self._consolidate_inplace()
    if (axis is None):
        axis = 0
    axis = self._get_axis_number(axis)
    from pandas import DataFrame
    if (value is None):
        if (self._is_mixed_type and (axis == 1)):
            if inplace:
                raise NotImplementedError()
            result = self.T.fillna(method=method, limit=limit).T
            result._data = result._data.downcast()
            return result
        if (self.ndim > 3):
            raise NotImplementedError('Cannot fillna with a method for > 3dims')
        elif (self.ndim == 3):
            result = {col: s.fillna(method=method, value=value) for (col, s) in self.iteritems()}
            prelim_obj = self._constructor.from_dict(result)
            new_obj = prelim_obj.__finalize__(self)
            new_data = new_obj._data
        else:
            new_data = self._data.interpolate(method=method, axis=axis, limit=limit, inplace=inplace, coerce=True, downcast=downcast)
    else:
        if (len(self._get_axis(axis)) == 0):
            return self
        if (self.ndim == 1):
            if isinstance(value, (dict, ABCSeries)):
                from pandas import Series
                value = Series(value)
            elif (not is_list_like(value)):
                pass
            else:
                raise TypeError('"value" parameter must be a scalar, dict or Series, but you passed a "{0}"'.format(type(value).__name__))
            new_data = self._data.fillna(value=value, limit=limit, inplace=inplace, downcast=downcast)
        elif isinstance(value, (dict, ABCSeries)):
            if (axis == 1):
                raise NotImplementedError('Currently only can fill with dict/Series column by column')
            result = (self if inplace else self.copy())
            for (k, v) in compat.iteritems(value):
                if (k not in result):
                    continue
                obj = result[k]
                obj.fillna(v, limit=limit, inplace=True, downcast=downcast)
            return (result if (not inplace) else None)
        elif (not is_list_like(value)):
            new_data = self._data.fillna(value=value, limit=limit, inplace=inplace, downcast=downcast)
        elif (isinstance(value, DataFrame) and (self.ndim == 2)):
            new_data = self.where(self.notna(), value)
        else:
            raise ValueError(('invalid fill value with a %s' % type(value)))
    if inplace:
        self._update_inplace(new_data)
    else:
        return self._constructor(new_data).__finalize__(self)
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
def fillna(self, value=None, method=None, axis=None, inplace=False, limit=None, downcast=None):
    "\n        Fill NA/NaN values using the specified method.\n\n        Parameters\n        ----------\n        value : scalar, dict, Series, or DataFrame\n            Value to use to fill holes (e.g. 0), alternately a\n            dict/Series/DataFrame of values specifying which value to use for\n            each index (for a Series) or column (for a DataFrame).  Values not\n            in the dict/Series/DataFrame will not be filled. This value cannot\n            be a list.\n        method : {'backfill', 'bfill', 'pad', 'ffill', None}, default None\n            Method to use for filling holes in reindexed Series\n            pad / ffill: propagate last valid observation forward to next valid\n            backfill / bfill: use next valid observation to fill gap.\n        axis : %(axes_single_arg)s\n            Axis along which to fill missing values.\n        inplace : bool, default False\n            If True, fill in-place. Note: this will modify any\n            other views on this object (e.g., a no-copy slice for a column in a\n            DataFrame).\n        limit : int, default None\n            If method is specified, this is the maximum number of consecutive\n            NaN values to forward/backward fill. In other words, if there is\n            a gap with more than this number of consecutive NaNs, it will only\n            be partially filled. If method is not specified, this is the\n            maximum number of entries along the entire axis where NaNs will be\n            filled. Must be greater than 0 if not None.\n        downcast : dict, default is None\n            A dict of item->dtype of what to downcast if possible,\n            or the string 'infer' which will try to downcast to an appropriate\n            equal type (e.g. float64 to int64 if possible).\n\n        Returns\n        -------\n        %(klass)s\n            Object with missing values filled.\n\n        See Also\n        --------\n        interpolate : Fill NaN values using interpolation.\n        reindex : Conform object to new index.\n        asfreq : Convert TimeSeries to specified frequency.\n\n        Examples\n        --------\n        >>> df = pd.DataFrame([[np.nan, 2, np.nan, 0],\n        ...                    [3, 4, np.nan, 1],\n        ...                    [np.nan, np.nan, np.nan, 5],\n        ...                    [np.nan, 3, np.nan, 4]],\n        ...                   columns=list('ABCD'))\n        >>> df\n             A    B   C  D\n        0  NaN  2.0 NaN  0\n        1  3.0  4.0 NaN  1\n        2  NaN  NaN NaN  5\n        3  NaN  3.0 NaN  4\n\n        Replace all NaN elements with 0s.\n\n        >>> df.fillna(0)\n            A   B   C   D\n        0   0.0 2.0 0.0 0\n        1   3.0 4.0 0.0 1\n        2   0.0 0.0 0.0 5\n        3   0.0 3.0 0.0 4\n\n        We can also propagate non-null values forward or backward.\n\n        >>> df.fillna(method='ffill')\n            A   B   C   D\n        0   NaN 2.0 NaN 0\n        1   3.0 4.0 NaN 1\n        2   3.0 4.0 NaN 5\n        3   3.0 3.0 NaN 4\n\n        Replace all NaN elements in column 'A', 'B', 'C', and 'D', with 0, 1,\n        2, and 3 respectively.\n\n        >>> values = {'A': 0, 'B': 1, 'C': 2, 'D': 3}\n        >>> df.fillna(value=values)\n            A   B   C   D\n        0   0.0 2.0 2.0 0\n        1   3.0 4.0 2.0 1\n        2   0.0 1.0 2.0 5\n        3   0.0 3.0 2.0 4\n\n        Only replace the first NaN element.\n\n        >>> df.fillna(value=values, limit=1)\n            A   B   C   D\n        0   0.0 2.0 2.0 0\n        1   3.0 4.0 NaN 1\n        2   NaN 1.0 NaN 5\n        3   NaN 3.0 NaN 4\n        "
    inplace = validate_bool_kwarg(inplace, 'inplace')
    (value, method) = validate_fillna_kwargs(value, method)
    self._consolidate_inplace()
    if (axis is None):
        axis = 0
    axis = self._get_axis_number(axis)
    from pandas import DataFrame
    if (value is None):
        if (self._is_mixed_type and (axis == 1)):
            if inplace:
                raise NotImplementedError()
            result = self.T.fillna(method=method, limit=limit).T
            result._data = result._data.downcast()
            return result
        if (self.ndim > 3):
            raise NotImplementedError('Cannot fillna with a method for > 3dims')
        elif (self.ndim == 3):
            result = {col: s.fillna(method=method, value=value) for (col, s) in self.iteritems()}
            prelim_obj = self._constructor.from_dict(result)
            new_obj = prelim_obj.__finalize__(self)
            new_data = new_obj._data
        else:
            new_data = self._data.interpolate(method=method, axis=axis, limit=limit, inplace=inplace, coerce=True, downcast=downcast)
    else:
        if (len(self._get_axis(axis)) == 0):
            return self
        if (self.ndim == 1):
            if isinstance(value, (dict, ABCSeries)):
                from pandas import Series
                value = Series(value)
            elif (not is_list_like(value)):
                pass
            else:
                raise TypeError('"value" parameter must be a scalar, dict or Series, but you passed a "{0}"'.format(type(value).__name__))
            new_data = self._data.fillna(value=value, limit=limit, inplace=inplace, downcast=downcast)
        elif isinstance(value, (dict, ABCSeries)):
            if (axis == 1):
                raise NotImplementedError('Currently only can fill with dict/Series column by column')
            result = (self if inplace else self.copy())
            for (k, v) in compat.iteritems(value):
                if (k not in result):
                    continue
                obj = result[k]
                obj.fillna(v, limit=limit, inplace=True, downcast=downcast)
            return (result if (not inplace) else None)
        elif (not is_list_like(value)):
            new_data = self._data.fillna(value=value, limit=limit, inplace=inplace, downcast=downcast)
        elif (isinstance(value, DataFrame) and (self.ndim == 2)):
            new_data = self.where(self.notna(), value)
        else:
            raise ValueError(('invalid fill value with a %s' % type(value)))
    if inplace:
        self._update_inplace(new_data)
    else:
        return self._constructor(new_data).__finalize__(self)