# dask.dataframe.Index.bfill

#### Index.bfill(axis=0, limit=None)

Fill NA/NaN values by using the next valid observation to fill the gap.

This docstring was copied from pandas.DataFrame.bfill.

Some inconsistencies with the Dask version may exist.

This method fills missing values in a backward direction along the
specified axis, propagating non-null values from later positions to
earlier positions containing NaN.

* **Parameters:**
  **axis**
  : Axis along which to fill missing values. For Series
    this parameter is unused and defaults to 0.

  **inplace**
  : 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**
  : Maximum number of consecutive NaN values to fill. In other words, if
    there is a gap with more than this number of consecutive NaNs, it
    will only be partially filled. Must be greater than 0 if not None.

  **limit_area**
  : Restrict which NaNs are filled based on their position relative to
    the valid values.
    * `None`: No fill restriction.
    * ‘inside’: Only fill NaNs surrounded by valid values
      (interpolate).
    * ‘outside’: Only fill NaNs outside valid values (extrapolate).
    <br/>
    #### Versionadded
    Added in version 2.2.0.
* **Returns:**
  Series/DataFrame
  : Object with missing values filled.

#### SEE ALSO
[`DataFrame.ffill`](dask.dataframe.DataFrame.ffill.html.md#dask.dataframe.DataFrame.ffill)
: Fill NA/NaN values by propagating the last valid observation to next valid.

### Examples

For Series:

```pycon
>>> s = pd.Series([1, None, None, 2])
>>> s.bfill()
0    1.0
1    2.0
2    2.0
3    2.0
dtype: float64
>>> s.bfill(limit=1)
0    1.0
1    NaN
2    2.0
3    2.0
dtype: float64
```

With DataFrame:

```pycon
>>> df = pd.DataFrame({"A": [1, None, None, 4], "B": [None, 5, None, 7]})
>>> df
      A     B
0   1.0   NaN
1   NaN   5.0
2   NaN   NaN
3   4.0   7.0
>>> df.bfill()
      A     B
0   1.0   5.0
1   4.0   5.0
2   4.0   7.0
3   4.0   7.0
>>> df.bfill(limit=1)
      A     B
0   1.0   5.0
1   NaN   5.0
2   4.0   7.0
3   4.0   7.0
```

<!-- !! processed by numpydoc !! -->
