From 247bc222ac617ab9a7053d6964125ffcce1a1a14 Mon Sep 17 00:00:00 2001 From: jreback Date: Thu, 1 May 2014 10:31:23 -0400 Subject: [PATCH 1/2] TST: tests for groupby not using grouper column, solved in GH7000, (GH5614) --- doc/source/release.rst | 2 +- doc/source/v0.14.0.txt | 2 +- pandas/tests/test_groupby.py | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/source/release.rst b/doc/source/release.rst index 4532c1d6eee11..f970d67faa752 100644 --- a/doc/source/release.rst +++ b/doc/source/release.rst @@ -188,7 +188,7 @@ API Changes validation warnings in :func:`read_csv`/:func:`read_table` (:issue:`6607`) - Raise a ``TypeError`` when ``DataFrame`` is passed an iterator as the ``data`` argument (:issue:`5357`) -- groupby will now not return the grouped column for non-cython functions (:issue:`5610`), +- groupby will now not return the grouped column for non-cython functions (:issue:`5610`, :issue:`5614`), as its already the index Deprecations diff --git a/doc/source/v0.14.0.txt b/doc/source/v0.14.0.txt index ffdd77bab9efd..bd91dc2d234d0 100644 --- a/doc/source/v0.14.0.txt +++ b/doc/source/v0.14.0.txt @@ -124,7 +124,7 @@ API changes g.nth(0, dropna='any') # similar to old behaviour - groupby will now not return the grouped column for non-cython functions (:issue:`5610`), + groupby will now not return the grouped column for non-cython functions (:issue:`5610`, :issue:`5614`), as its already the index .. ipython:: python diff --git a/pandas/tests/test_groupby.py b/pandas/tests/test_groupby.py index fcc4eb83b0af9..9b7c07325dfbb 100644 --- a/pandas/tests/test_groupby.py +++ b/pandas/tests/test_groupby.py @@ -2029,6 +2029,16 @@ def test_non_cython_api(self): result = g.idxmax() assert_frame_equal(result,expected) + # cumsum (GH5614) + df = DataFrame([[1, 2, np.nan], [1, np.nan, 9], [3, 4, 9]], columns=['A', 'B', 'C']) + expected = DataFrame([[2, np.nan], [np.nan, 9], [4, 9]], columns=['B', 'C']) + result = df.groupby('A').cumsum() + assert_frame_equal(result,expected) + + expected = DataFrame([[1, 2, np.nan], [2, np.nan, 9], [3, 4, 9]], columns=['A', 'B', 'C']).astype('float64') + result = df.groupby('A', as_index=False).cumsum() + assert_frame_equal(result,expected) + def test_grouping_ndarray(self): grouped = self.df.groupby(self.df['A'].values) From fd757ce64038e0f15d3ecf4b3d69dce3e278a1af Mon Sep 17 00:00:00 2001 From: jreback Date: Thu, 1 May 2014 11:12:54 -0400 Subject: [PATCH 2/2] CLN: fix invalid line in test_offsets.py --- pandas/tseries/tests/test_offsets.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pandas/tseries/tests/test_offsets.py b/pandas/tseries/tests/test_offsets.py index 95940ab9abbfb..5e426a75e8d63 100644 --- a/pandas/tseries/tests/test_offsets.py +++ b/pandas/tseries/tests/test_offsets.py @@ -2869,4 +2869,3 @@ def test_str_for_named_is_name(self): if __name__ == '__main__': nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'], exit=False) - \ No newline at end of file