diff --git a/third_party/bigframes_vendored/pandas/core/generic.py b/third_party/bigframes_vendored/pandas/core/generic.py index 72b947f96c..2ca51f6493 100644 --- a/third_party/bigframes_vendored/pandas/core/generic.py +++ b/third_party/bigframes_vendored/pandas/core/generic.py @@ -627,6 +627,48 @@ def copy(self): def ffill(self, *, limit: Optional[int] = None): """Fill NA/NaN values by propagating the last valid observation to next valid. + **Examples:** + + >>> import bigframes.pandas as bpd + >>> import numpy as np + >>> bpd.options.display.progress_bar = None + + >>> df = bpd.DataFrame([[np.nan, 2, np.nan, 0], + ... [3, 4, np.nan, 1], + ... [np.nan, np.nan, np.nan, np.nan], + ... [np.nan, 3, np.nan, 4]], + ... columns=list("ABCD")).astype("Float64") + >>> df + A B C D + 0 2.0 0.0 + 1 3.0 4.0 1.0 + 2 + 3 3.0 4.0 + + [4 rows x 4 columns] + + Fill NA/NaN values in DataFrames: + + >>> df.ffill() + A B C D + 0 2.0 0.0 + 1 3.0 4.0 1.0 + 2 3.0 4.0 1.0 + 3 3.0 3.0 4.0 + + [4 rows x 4 columns] + + + Fill NA/NaN values in Series: + + >>> series = bpd.Series([1, np.nan, 2, 3]) + >>> series.ffill() + 0 1.0 + 1 1.0 + 2 2.0 + 3 3.0 + dtype: Float64 + Args: limit : int, default None If method is specified, this is the maximum number of consecutive