From 728249016b33f753e04fbcbecda112495b33f897 Mon Sep 17 00:00:00 2001 From: "hesham.shabana@hotmail.com" Date: Mon, 12 Dec 2016 10:34:17 +0200 Subject: [PATCH] Fix issue: 14861 --- doc/source/groupby.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/source/groupby.rst b/doc/source/groupby.rst index ff97775afc2e2..bb03c7def694e 100644 --- a/doc/source/groupby.rst +++ b/doc/source/groupby.rst @@ -631,11 +631,11 @@ the column B based on the groups of column A. .. ipython:: python - df = pd.DataFrame({'A': [1] * 10 + [5] * 10, + df_re = pd.DataFrame({'A': [1] * 10 + [5] * 10, 'B': np.arange(20)}) - df - - df.groupby('A').rolling(4).B.mean() + df_re + + df_re.groupby('A').rolling(4).B.mean() The ``expanding()`` method will accumulate a given operation @@ -644,7 +644,7 @@ group. .. ipython:: python - df.groupby('A').expanding().sum() + df_re.groupby('A').expanding().sum() Suppose you want to use the ``resample()`` method to get a daily @@ -653,14 +653,14 @@ missing values with the ``ffill()`` method. .. ipython:: python - df = pd.DataFrame({'date': pd.date_range(start='2016-01-01', + df_re = pd.DataFrame({'date': pd.date_range(start='2016-01-01', periods=4, freq='W'), 'group': [1, 1, 2, 2], 'val': [5, 6, 7, 8]}).set_index('date') - df + df_re - df.groupby('group').resample('1D').ffill() + df_re.groupby('group').resample('1D').ffill() .. _groupby.filter: