From 8b38d7ac0d2b20a84a39218df951b60489d013a6 Mon Sep 17 00:00:00 2001 From: Noritada Kobayashi Date: Sat, 17 Aug 2019 23:41:51 +0900 Subject: [PATCH 1/6] BUG/TST: fix and test for timezone drop in GroupBy.shift/bfill/ffill --- doc/source/whatsnew/v0.25.1.rst | 1 + pandas/core/groupby/groupby.py | 12 +-- pandas/tests/groupby/test_timezone.py | 112 ++++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 5 deletions(-) create mode 100644 pandas/tests/groupby/test_timezone.py diff --git a/doc/source/whatsnew/v0.25.1.rst b/doc/source/whatsnew/v0.25.1.rst index 34b149a6b8261..863780610fee5 100644 --- a/doc/source/whatsnew/v0.25.1.rst +++ b/doc/source/whatsnew/v0.25.1.rst @@ -120,6 +120,7 @@ Groupby/resample/rolling - Bug in :meth:`pandas.core.groupby.DataFrameGroupBy.transform` where applying a timezone conversion lambda function would drop timezone information (:issue:`27496`) - Bug in windowing over read-only arrays (:issue:`27766`) - Fixed segfault in `pandas.core.groupby.DataFrameGroupBy.quantile` when an invalid quantile was passed (:issue:`27470`) +- Bug in :meth:`pandas.core.groupby.GroupBy.shift`, :meth:`pandas.core.groupby.GroupBy.bfill` and :meth:`pandas.core.groupby.GroupBy.ffill` where timezone information would be dropped (:issue:`xxxxx`) - Reshaping diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index c5e81e21e9fd5..05005d2ca94b1 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -2220,26 +2220,28 @@ def _get_cythonized_result( base_func = getattr(libgroupby, how) for name, obj in self._iterate_slices(): + values = obj._data._values + if aggregate: result_sz = ngroups else: - result_sz = len(obj.values) + result_sz = len(values) if not cython_dtype: - cython_dtype = obj.values.dtype + cython_dtype = values.dtype result = np.zeros(result_sz, dtype=cython_dtype) func = partial(base_func, result, labels) inferences = None if needs_values: - vals = obj.values + vals = values if pre_processing: vals, inferences = pre_processing(vals) func = partial(func, vals) if needs_mask: - mask = isna(obj.values).view(np.uint8) + mask = isna(values).view(np.uint8) func = partial(func, mask) if needs_ngroups: @@ -2248,7 +2250,7 @@ def _get_cythonized_result( func(**kwargs) # Call func to modify indexer values in place if result_is_index: - result = algorithms.take_nd(obj.values, result) + result = algorithms.take_nd(values, result) if post_processing: result = post_processing(result, inferences) diff --git a/pandas/tests/groupby/test_timezone.py b/pandas/tests/groupby/test_timezone.py new file mode 100644 index 0000000000000..caa9f9323a664 --- /dev/null +++ b/pandas/tests/groupby/test_timezone.py @@ -0,0 +1,112 @@ +import pytest + +from pandas import DataFrame, Timestamp +from pandas.util.testing import assert_frame_equal + + +@pytest.mark.parametrize( + "data, expected_shift, expected_bfill, expected_ffill", + [ + ( + { + "id": ["A", "B", "A", "B", "A", "B"], + "time": [ + Timestamp("2019-01-01 12:00:00"), + Timestamp("2019-01-01 12:30:00"), + None, + None, + Timestamp("2019-01-01 14:00:00"), + Timestamp("2019-01-01 14:30:00"), + ], + }, + { + "time": [ + None, + None, + Timestamp("2019-01-01 12:00:00"), + Timestamp("2019-01-01 12:30:00"), + None, + None, + ] + }, + { + "time": [ + Timestamp("2019-01-01 12:00:00"), + Timestamp("2019-01-01 12:30:00"), + Timestamp("2019-01-01 14:00:00"), + Timestamp("2019-01-01 14:30:00"), + Timestamp("2019-01-01 14:00:00"), + Timestamp("2019-01-01 14:30:00"), + ] + }, + { + "time": [ + Timestamp("2019-01-01 12:00:00"), + Timestamp("2019-01-01 12:30:00"), + Timestamp("2019-01-01 12:00:00"), + Timestamp("2019-01-01 12:30:00"), + Timestamp("2019-01-01 14:00:00"), + Timestamp("2019-01-01 14:30:00"), + ] + }, + ), + ( + { + "id": ["A", "B", "A", "B", "A", "B"], + "time": [ + Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), + None, + None, + Timestamp("2019-01-01 14:00:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 14:30:00", tz="Asia/Tokyo"), + ], + }, + { + "time": [ + None, + None, + Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), + None, + None, + ] + }, + { + "time": [ + Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 14:00:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 14:30:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 14:00:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 14:30:00", tz="Asia/Tokyo"), + ] + }, + { + "time": [ + Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 14:00:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 14:30:00", tz="Asia/Tokyo"), + ] + }, + ), + ], +) +def test_shift_bfill_ffill_tz(data, expected_shift, expected_bfill, expected_ffill): + # GHxxxxx: Check that timezone does not drop in shift, bfill, and ffill + df = DataFrame(data) + + result = df.groupby("id").shift() + expected = DataFrame(expected_shift) + assert_frame_equal(result, expected) + + result = df.groupby("id").bfill() + expected = DataFrame(expected_bfill) + assert_frame_equal(result, expected) + + result = df.groupby("id").ffill() + expected = DataFrame(expected_ffill) + assert_frame_equal(result, expected) From 887c6e76388b901951611987f7b66671f0505fbe Mon Sep 17 00:00:00 2001 From: Noritada Kobayashi Date: Mon, 19 Aug 2019 08:29:10 +0900 Subject: [PATCH 2/6] Fill issue number placeholders with a PR number (#27992) --- doc/source/whatsnew/v0.25.1.rst | 2 +- pandas/tests/groupby/test_timezone.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/whatsnew/v0.25.1.rst b/doc/source/whatsnew/v0.25.1.rst index 863780610fee5..b35c8919dbd44 100644 --- a/doc/source/whatsnew/v0.25.1.rst +++ b/doc/source/whatsnew/v0.25.1.rst @@ -120,7 +120,7 @@ Groupby/resample/rolling - Bug in :meth:`pandas.core.groupby.DataFrameGroupBy.transform` where applying a timezone conversion lambda function would drop timezone information (:issue:`27496`) - Bug in windowing over read-only arrays (:issue:`27766`) - Fixed segfault in `pandas.core.groupby.DataFrameGroupBy.quantile` when an invalid quantile was passed (:issue:`27470`) -- Bug in :meth:`pandas.core.groupby.GroupBy.shift`, :meth:`pandas.core.groupby.GroupBy.bfill` and :meth:`pandas.core.groupby.GroupBy.ffill` where timezone information would be dropped (:issue:`xxxxx`) +- Bug in :meth:`pandas.core.groupby.GroupBy.shift`, :meth:`pandas.core.groupby.GroupBy.bfill` and :meth:`pandas.core.groupby.GroupBy.ffill` where timezone information would be dropped (:issue:`27992`) - Reshaping diff --git a/pandas/tests/groupby/test_timezone.py b/pandas/tests/groupby/test_timezone.py index caa9f9323a664..6f6c635050427 100644 --- a/pandas/tests/groupby/test_timezone.py +++ b/pandas/tests/groupby/test_timezone.py @@ -96,7 +96,7 @@ ], ) def test_shift_bfill_ffill_tz(data, expected_shift, expected_bfill, expected_ffill): - # GHxxxxx: Check that timezone does not drop in shift, bfill, and ffill + # GH27992: Check that timezone does not drop in shift, bfill, and ffill df = DataFrame(data) result = df.groupby("id").shift() From 0812ccf9918ebcec74530c0f3f98043edfd0331c Mon Sep 17 00:00:00 2001 From: Noritada Kobayashi Date: Mon, 19 Aug 2019 22:29:43 +0900 Subject: [PATCH 3/6] Relocate a test function as suggested by Matthew Roeschke (@mroeschke) --- pandas/tests/groupby/test_groupby.py | 108 +++++++++++++++++++++++++ pandas/tests/groupby/test_timezone.py | 112 -------------------------- 2 files changed, 108 insertions(+), 112 deletions(-) delete mode 100644 pandas/tests/groupby/test_timezone.py diff --git a/pandas/tests/groupby/test_groupby.py b/pandas/tests/groupby/test_groupby.py index 4556b22b57279..a539c1901a220 100644 --- a/pandas/tests/groupby/test_groupby.py +++ b/pandas/tests/groupby/test_groupby.py @@ -1882,3 +1882,111 @@ def test_groupby_axis_1(group_name): results = df.groupby(group_name, axis=1).sum() expected = df.T.groupby(group_name).sum().T assert_frame_equal(results, expected) + + +@pytest.mark.parametrize( + "data, expected_shift, expected_bfill, expected_ffill", + [ + ( + { + "id": ["A", "B", "A", "B", "A", "B"], + "time": [ + Timestamp("2019-01-01 12:00:00"), + Timestamp("2019-01-01 12:30:00"), + None, + None, + Timestamp("2019-01-01 14:00:00"), + Timestamp("2019-01-01 14:30:00"), + ], + }, + { + "time": [ + None, + None, + Timestamp("2019-01-01 12:00:00"), + Timestamp("2019-01-01 12:30:00"), + None, + None, + ] + }, + { + "time": [ + Timestamp("2019-01-01 12:00:00"), + Timestamp("2019-01-01 12:30:00"), + Timestamp("2019-01-01 14:00:00"), + Timestamp("2019-01-01 14:30:00"), + Timestamp("2019-01-01 14:00:00"), + Timestamp("2019-01-01 14:30:00"), + ] + }, + { + "time": [ + Timestamp("2019-01-01 12:00:00"), + Timestamp("2019-01-01 12:30:00"), + Timestamp("2019-01-01 12:00:00"), + Timestamp("2019-01-01 12:30:00"), + Timestamp("2019-01-01 14:00:00"), + Timestamp("2019-01-01 14:30:00"), + ] + }, + ), + ( + { + "id": ["A", "B", "A", "B", "A", "B"], + "time": [ + Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), + None, + None, + Timestamp("2019-01-01 14:00:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 14:30:00", tz="Asia/Tokyo"), + ], + }, + { + "time": [ + None, + None, + Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), + None, + None, + ] + }, + { + "time": [ + Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 14:00:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 14:30:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 14:00:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 14:30:00", tz="Asia/Tokyo"), + ] + }, + { + "time": [ + Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 14:00:00", tz="Asia/Tokyo"), + Timestamp("2019-01-01 14:30:00", tz="Asia/Tokyo"), + ] + }, + ), + ], +) +def test_shift_bfill_ffill_tz(data, expected_shift, expected_bfill, expected_ffill): + # GH27992: Check that timezone does not drop in shift, bfill, and ffill + df = DataFrame(data) + + result = df.groupby("id").shift() + expected = DataFrame(expected_shift) + assert_frame_equal(result, expected) + + result = df.groupby("id").bfill() + expected = DataFrame(expected_bfill) + assert_frame_equal(result, expected) + + result = df.groupby("id").ffill() + expected = DataFrame(expected_ffill) + assert_frame_equal(result, expected) diff --git a/pandas/tests/groupby/test_timezone.py b/pandas/tests/groupby/test_timezone.py deleted file mode 100644 index 6f6c635050427..0000000000000 --- a/pandas/tests/groupby/test_timezone.py +++ /dev/null @@ -1,112 +0,0 @@ -import pytest - -from pandas import DataFrame, Timestamp -from pandas.util.testing import assert_frame_equal - - -@pytest.mark.parametrize( - "data, expected_shift, expected_bfill, expected_ffill", - [ - ( - { - "id": ["A", "B", "A", "B", "A", "B"], - "time": [ - Timestamp("2019-01-01 12:00:00"), - Timestamp("2019-01-01 12:30:00"), - None, - None, - Timestamp("2019-01-01 14:00:00"), - Timestamp("2019-01-01 14:30:00"), - ], - }, - { - "time": [ - None, - None, - Timestamp("2019-01-01 12:00:00"), - Timestamp("2019-01-01 12:30:00"), - None, - None, - ] - }, - { - "time": [ - Timestamp("2019-01-01 12:00:00"), - Timestamp("2019-01-01 12:30:00"), - Timestamp("2019-01-01 14:00:00"), - Timestamp("2019-01-01 14:30:00"), - Timestamp("2019-01-01 14:00:00"), - Timestamp("2019-01-01 14:30:00"), - ] - }, - { - "time": [ - Timestamp("2019-01-01 12:00:00"), - Timestamp("2019-01-01 12:30:00"), - Timestamp("2019-01-01 12:00:00"), - Timestamp("2019-01-01 12:30:00"), - Timestamp("2019-01-01 14:00:00"), - Timestamp("2019-01-01 14:30:00"), - ] - }, - ), - ( - { - "id": ["A", "B", "A", "B", "A", "B"], - "time": [ - Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), - None, - None, - Timestamp("2019-01-01 14:00:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 14:30:00", tz="Asia/Tokyo"), - ], - }, - { - "time": [ - None, - None, - Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), - None, - None, - ] - }, - { - "time": [ - Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 14:00:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 14:30:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 14:00:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 14:30:00", tz="Asia/Tokyo"), - ] - }, - { - "time": [ - Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 14:00:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 14:30:00", tz="Asia/Tokyo"), - ] - }, - ), - ], -) -def test_shift_bfill_ffill_tz(data, expected_shift, expected_bfill, expected_ffill): - # GH27992: Check that timezone does not drop in shift, bfill, and ffill - df = DataFrame(data) - - result = df.groupby("id").shift() - expected = DataFrame(expected_shift) - assert_frame_equal(result, expected) - - result = df.groupby("id").bfill() - expected = DataFrame(expected_bfill) - assert_frame_equal(result, expected) - - result = df.groupby("id").ffill() - expected = DataFrame(expected_ffill) - assert_frame_equal(result, expected) From 43b42d5092c3c6f6b2f45934c2147dcf3af104ba Mon Sep 17 00:00:00 2001 From: Noritada Kobayashi Date: Mon, 19 Aug 2019 22:46:07 +0900 Subject: [PATCH 4/6] Parameterize methods as per a suggestion from Matthew Roeschke (@mroeschke) --- pandas/tests/groupby/test_groupby.py | 92 ++++++++-------------------- 1 file changed, 25 insertions(+), 67 deletions(-) diff --git a/pandas/tests/groupby/test_groupby.py b/pandas/tests/groupby/test_groupby.py index a539c1901a220..b8f19d8dafe9f 100644 --- a/pandas/tests/groupby/test_groupby.py +++ b/pandas/tests/groupby/test_groupby.py @@ -1884,21 +1884,12 @@ def test_groupby_axis_1(group_name): assert_frame_equal(results, expected) +@pytest.mark.parametrize("tz", [None, "Asia/Tokyo"]) @pytest.mark.parametrize( - "data, expected_shift, expected_bfill, expected_ffill", + "op, expected", [ ( - { - "id": ["A", "B", "A", "B", "A", "B"], - "time": [ - Timestamp("2019-01-01 12:00:00"), - Timestamp("2019-01-01 12:30:00"), - None, - None, - Timestamp("2019-01-01 14:00:00"), - Timestamp("2019-01-01 14:30:00"), - ], - }, + "shift", { "time": [ None, @@ -1909,6 +1900,9 @@ def test_groupby_axis_1(group_name): None, ] }, + ), + ( + "bfill", { "time": [ Timestamp("2019-01-01 12:00:00"), @@ -1919,6 +1913,9 @@ def test_groupby_axis_1(group_name): Timestamp("2019-01-01 14:30:00"), ] }, + ), + ( + "ffill", { "time": [ Timestamp("2019-01-01 12:00:00"), @@ -1930,63 +1927,24 @@ def test_groupby_axis_1(group_name): ] }, ), - ( - { - "id": ["A", "B", "A", "B", "A", "B"], - "time": [ - Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), - None, - None, - Timestamp("2019-01-01 14:00:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 14:30:00", tz="Asia/Tokyo"), - ], - }, - { - "time": [ - None, - None, - Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), - None, - None, - ] - }, - { - "time": [ - Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 14:00:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 14:30:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 14:00:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 14:30:00", tz="Asia/Tokyo"), - ] - }, - { - "time": [ - Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 12:00:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 12:30:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 14:00:00", tz="Asia/Tokyo"), - Timestamp("2019-01-01 14:30:00", tz="Asia/Tokyo"), - ] - }, - ), ], ) -def test_shift_bfill_ffill_tz(data, expected_shift, expected_bfill, expected_ffill): +def test_shift_bfill_ffill_tz(tz, op, expected): # GH27992: Check that timezone does not drop in shift, bfill, and ffill - df = DataFrame(data) - - result = df.groupby("id").shift() - expected = DataFrame(expected_shift) - assert_frame_equal(result, expected) - - result = df.groupby("id").bfill() - expected = DataFrame(expected_bfill) - assert_frame_equal(result, expected) + data = { + "id": ["A", "B", "A", "B", "A", "B"], + "time": [ + Timestamp("2019-01-01 12:00:00"), + Timestamp("2019-01-01 12:30:00"), + None, + None, + Timestamp("2019-01-01 14:00:00"), + Timestamp("2019-01-01 14:30:00"), + ], + } + df = DataFrame(data).assign(time=lambda x: x.time.dt.tz_localize(tz)) - result = df.groupby("id").ffill() - expected = DataFrame(expected_ffill) + grouped = df.groupby("id") + result = getattr(grouped, op)() + expected = DataFrame(expected).assign(time=lambda x: x.time.dt.tz_localize(tz)) assert_frame_equal(result, expected) From b5a373535f24f4dcbee85566293097a0b582beb1 Mon Sep 17 00:00:00 2001 From: Noritada Kobayashi Date: Tue, 20 Aug 2019 04:19:38 +0900 Subject: [PATCH 5/6] Use a predefined fixture function for tz parameterization thanks to @mroeschke --- pandas/tests/groupby/test_groupby.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/tests/groupby/test_groupby.py b/pandas/tests/groupby/test_groupby.py index b8f19d8dafe9f..b9145de787730 100644 --- a/pandas/tests/groupby/test_groupby.py +++ b/pandas/tests/groupby/test_groupby.py @@ -1884,7 +1884,6 @@ def test_groupby_axis_1(group_name): assert_frame_equal(results, expected) -@pytest.mark.parametrize("tz", [None, "Asia/Tokyo"]) @pytest.mark.parametrize( "op, expected", [ @@ -1929,8 +1928,9 @@ def test_groupby_axis_1(group_name): ), ], ) -def test_shift_bfill_ffill_tz(tz, op, expected): +def test_shift_bfill_ffill_tz(tz_naive_fixture, op, expected): # GH27992: Check that timezone does not drop in shift, bfill, and ffill + tz = tz_naive_fixture data = { "id": ["A", "B", "A", "B", "A", "B"], "time": [ From 6eb0d287f5698c93ab759de928b254fb3cb86fe7 Mon Sep 17 00:00:00 2001 From: Noritada Kobayashi Date: Mon, 9 Sep 2019 20:07:36 +0900 Subject: [PATCH 6/6] Document additionally an existing issue number #19995 for GroupBy.shift --- doc/source/whatsnew/v0.25.2.rst | 2 +- pandas/tests/groupby/test_groupby.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/whatsnew/v0.25.2.rst b/doc/source/whatsnew/v0.25.2.rst index 620d2c0725eca..69f324211e5b2 100644 --- a/doc/source/whatsnew/v0.25.2.rst +++ b/doc/source/whatsnew/v0.25.2.rst @@ -78,7 +78,7 @@ Groupby/resample/rolling ^^^^^^^^^^^^^^^^^^^^^^^^ - Bug incorrectly raising an ``IndexError`` when passing a list of quantiles to :meth:`pandas.core.groupby.DataFrameGroupBy.quantile` (:issue:`28113`). -- Bug in :meth:`pandas.core.groupby.GroupBy.shift`, :meth:`pandas.core.groupby.GroupBy.bfill` and :meth:`pandas.core.groupby.GroupBy.ffill` where timezone information would be dropped (:issue:`27992`) +- Bug in :meth:`pandas.core.groupby.GroupBy.shift`, :meth:`pandas.core.groupby.GroupBy.bfill` and :meth:`pandas.core.groupby.GroupBy.ffill` where timezone information would be dropped (:issue:`19995`, :issue:`27992`) - - - diff --git a/pandas/tests/groupby/test_groupby.py b/pandas/tests/groupby/test_groupby.py index b9145de787730..bec5cbc5fecb8 100644 --- a/pandas/tests/groupby/test_groupby.py +++ b/pandas/tests/groupby/test_groupby.py @@ -1929,7 +1929,7 @@ def test_groupby_axis_1(group_name): ], ) def test_shift_bfill_ffill_tz(tz_naive_fixture, op, expected): - # GH27992: Check that timezone does not drop in shift, bfill, and ffill + # GH19995, GH27992: Check that timezone does not drop in shift, bfill, and ffill tz = tz_naive_fixture data = { "id": ["A", "B", "A", "B", "A", "B"],