From 7be630df6e4f7bce38e8329507edb0bd93c12ece Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Fri, 22 Jun 2018 08:35:01 -0700 Subject: [PATCH 1/6] TST: Cleanup Timezone issues --- pandas/tests/frame/test_indexing.py | 24 +++++++++++++++++++ .../indexes/datetimes/test_date_range.py | 9 +++++++ pandas/tests/indexes/datetimes/test_ops.py | 7 ++++++ .../tests/scalar/timestamp/test_timestamp.py | 8 +++++++ pandas/tests/series/test_replace.py | 9 +++++++ pandas/tests/series/test_timezones.py | 8 +++++++ 6 files changed, 65 insertions(+) diff --git a/pandas/tests/frame/test_indexing.py b/pandas/tests/frame/test_indexing.py index be37e696ea0a3..a92b102246c49 100644 --- a/pandas/tests/frame/test_indexing.py +++ b/pandas/tests/frame/test_indexing.py @@ -1688,6 +1688,20 @@ def test_getitem_list_duplicates(self): expected = df.iloc[:, 2:] assert_frame_equal(result, expected) + def test_getitem_setitem_datetimeindex_tz(self): + # GH 11679 + data = ['2016-06-28 08:30:00.123456789'] + index = DatetimeIndex(data, dtype='datetime64[ns, America/Chicago]') + df = DataFrame({'a': [10]}, index=index) + result = df.loc[df.index[0]] + expected = Series(10, index=['a'], name=df.index[0]) + tm.assert_series_equal(result, expected) + + result = df.copy() + result.loc[df.index[0], 'a'] = -1 + expected = DataFrame(-1, index=index, columns=['a']) + tm.assert_frame_equal(result, expected) + def test_get_value(self): for idx in self.frame.index: for col in self.frame.columns: @@ -2248,6 +2262,16 @@ def test_setitem_datetimelike_with_inference(self): index=list('ABCDEFGH')) assert_series_equal(result, expected) + @pytest.mark.parametrize('idxer', ['var', ['var']]) + @pytest.mark.parametrize('tz', [None, 'UTC']) + def test_setitem_datetimeindex_tz(self, idxer, tz): + #GH 11365 + idx = date_range(start='2015-07-12', periods=3, freq='H', tz=tz) + expected = DataFrame(1.2, index=idx, columns=['var']) + result = DataFrame(index=idx, columns=['var']) + result.loc[:, idxer] = expected + tm.assert_frame_equal(result, expected) + def test_at_time_between_time_datetimeindex(self): index = date_range("2012-01-01", "2012-01-05", freq='30min') df = DataFrame(randn(len(index), 5), index=index) diff --git a/pandas/tests/indexes/datetimes/test_date_range.py b/pandas/tests/indexes/datetimes/test_date_range.py index ec37bbbcb6c02..74cf6fb8ec247 100644 --- a/pandas/tests/indexes/datetimes/test_date_range.py +++ b/pandas/tests/indexes/datetimes/test_date_range.py @@ -292,6 +292,15 @@ def test_construct_over_dst(self): freq='H', tz='US/Pacific') tm.assert_index_equal(result, expected) + def test_construct_with_different_start_end_string_format(self): + # GH 12064 + result = date_range('2013-01-01 00:00:00+09:00', + '2013/01/01 02:00:00+09:00', freq='H') + expected = DatetimeIndex([Timestamp('2013-01-01 00:00:00+09:00'), + Timestamp('2013-01-01 01:00:00+09:00'), + Timestamp('2013-01-01 02:00:00+09:00')]) + tm.assert_index_equal(result, expected) + class TestGenRangeGeneration(object): diff --git a/pandas/tests/indexes/datetimes/test_ops.py b/pandas/tests/indexes/datetimes/test_ops.py index c6334e70a1d2c..46397e292bb2c 100644 --- a/pandas/tests/indexes/datetimes/test_ops.py +++ b/pandas/tests/indexes/datetimes/test_ops.py @@ -450,6 +450,13 @@ def test_offset_deprecated(self): with tm.assert_produces_warning(FutureWarning): idx.offset = BDay() + def test_ts_datetimeindex_compare_mismatched_tz(self): + # GH 12601 + idx = date_range('2016-01-01 12:00', periods=10, + freq='H', tz='Asia/Tokyo') + with pytest.raises(TypeError): + idx > pd.Timestamp('2016-01-01 08:00') + class TestBusinessDatetimeIndex(object): diff --git a/pandas/tests/scalar/timestamp/test_timestamp.py b/pandas/tests/scalar/timestamp/test_timestamp.py index 8dc9903b7356d..5272059163a07 100644 --- a/pandas/tests/scalar/timestamp/test_timestamp.py +++ b/pandas/tests/scalar/timestamp/test_timestamp.py @@ -542,6 +542,14 @@ def test_construct_timestamp_near_dst(self, offset): result = Timestamp(expected, tz='Europe/Helsinki') assert result == expected + @pytest.mark.parametrize('arg', [ + '2013/01/01 00:00:00+09:00', '2013-01-01 00:00:00+09:00']) + def test_construct_with_different_string_format(self, arg): + # GH 12064 + result = Timestamp(arg) + expected = Timestamp(datetime(2013, 1, 1), tz=pytz.FixedOffset(540)) + assert result == expected + class TestTimestamp(object): diff --git a/pandas/tests/series/test_replace.py b/pandas/tests/series/test_replace.py index 2c07d87865f53..4fdf9e84df0f8 100644 --- a/pandas/tests/series/test_replace.py +++ b/pandas/tests/series/test_replace.py @@ -249,3 +249,12 @@ def test_replace_mixed_types_with_string(self): result = s.replace([2, '4'], np.nan) expected = pd.Series([1, np.nan, 3, np.nan, 4, 5]) tm.assert_series_equal(expected, result) + + @pytest.mark.parametrize('to_replace', [pd.NaT, [np.nan, pd.NaT]]) + def test_replace_with_tz_aware_data(self, to_replace): + # GH 11792 + ts = pd.Timestamp('2015/01/01', tz='UTC') + s = pd.Series([pd.NaT, pd.Timestamp('2015/01/01', tz='UTC')]) + result = s.replace(to_replace, pd.Timestamp.min) + expected = pd.Series([pd.Timestamp.min, ts], dtype=object) + tm.assert_series_equal(expected, result) diff --git a/pandas/tests/series/test_timezones.py b/pandas/tests/series/test_timezones.py index b54645d04bd1a..f2433163352ac 100644 --- a/pandas/tests/series/test_timezones.py +++ b/pandas/tests/series/test_timezones.py @@ -300,3 +300,11 @@ def test_getitem_pydatetime_tz(self, tzstr): dt = datetime(2012, 12, 24, 17, 0) time_datetime = tslib._localize_pydatetime(dt, tz) assert ts[time_pandas] == ts[time_datetime] + + def test_series_truncate_datetimeindex_tz(self): + # GH 9243 + idx = date_range('4/1/2005', '4/30/2005', freq='D', tz='US/Pacific') + s = Series(range(len(idx)), index=idx) + result = s.truncate(datetime(2005, 4, 2), datetime(2005, 4, 4)) + expected = Series([1, 2, 3], index=idx[1:4]) + tm.assert_series_equal(result, expected) From 64bb8c4778d1c297bada4f41a3344420eca0d6bf Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Sat, 23 Jun 2018 09:31:20 -0700 Subject: [PATCH 2/6] Add additional tests --- pandas/conftest.py | 22 +++++++++++++++++++ pandas/tests/frame/test_indexing.py | 2 +- .../indexes/datetimes/test_date_range.py | 2 +- pandas/tests/indexes/datetimes/test_ops.py | 5 +++-- pandas/tests/series/test_constructors.py | 8 +++++++ 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/pandas/conftest.py b/pandas/conftest.py index d6b18db4e71f2..56473971d9c70 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -1,3 +1,5 @@ +import operator + import pytest import numpy as np @@ -249,3 +251,23 @@ def any_int_dtype(request): """ return request.param + + +COMPARISON_OPERATORS = [operator.lt, operator.le, operator.eq, operator.ne, + operator.ge, operator.gt] + + +@pytest.fixture(params=COMPARISON_OPERATORS) +def comparison_fixture(request): + """ + Parameterized fixture for comparison operators. + + * >= + * > + * == + * != + * < + * <= + """ + + return request.param diff --git a/pandas/tests/frame/test_indexing.py b/pandas/tests/frame/test_indexing.py index a92b102246c49..87263f1fd60a3 100644 --- a/pandas/tests/frame/test_indexing.py +++ b/pandas/tests/frame/test_indexing.py @@ -2265,7 +2265,7 @@ def test_setitem_datetimelike_with_inference(self): @pytest.mark.parametrize('idxer', ['var', ['var']]) @pytest.mark.parametrize('tz', [None, 'UTC']) def test_setitem_datetimeindex_tz(self, idxer, tz): - #GH 11365 + # GH 11365 idx = date_range(start='2015-07-12', periods=3, freq='H', tz=tz) expected = DataFrame(1.2, index=idx, columns=['var']) result = DataFrame(index=idx, columns=['var']) diff --git a/pandas/tests/indexes/datetimes/test_date_range.py b/pandas/tests/indexes/datetimes/test_date_range.py index 74cf6fb8ec247..47d4d15420f1d 100644 --- a/pandas/tests/indexes/datetimes/test_date_range.py +++ b/pandas/tests/indexes/datetimes/test_date_range.py @@ -299,7 +299,7 @@ def test_construct_with_different_start_end_string_format(self): expected = DatetimeIndex([Timestamp('2013-01-01 00:00:00+09:00'), Timestamp('2013-01-01 01:00:00+09:00'), Timestamp('2013-01-01 02:00:00+09:00')]) - tm.assert_index_equal(result, expected) + tm.assert_index_equal(result, expected) class TestGenRangeGeneration(object): diff --git a/pandas/tests/indexes/datetimes/test_ops.py b/pandas/tests/indexes/datetimes/test_ops.py index 46397e292bb2c..468c9999857ee 100644 --- a/pandas/tests/indexes/datetimes/test_ops.py +++ b/pandas/tests/indexes/datetimes/test_ops.py @@ -450,12 +450,13 @@ def test_offset_deprecated(self): with tm.assert_produces_warning(FutureWarning): idx.offset = BDay() - def test_ts_datetimeindex_compare_mismatched_tz(self): + def test_ts_datetimeindex_compare_mismatched_tz(self, comparison_fixture): # GH 12601 + comparison = comparison_fixture idx = date_range('2016-01-01 12:00', periods=10, freq='H', tz='Asia/Tokyo') with pytest.raises(TypeError): - idx > pd.Timestamp('2016-01-01 08:00') + comparison(idx, pd.Timestamp('2016-01-01 08:00')) class TestBusinessDatetimeIndex(object): diff --git a/pandas/tests/series/test_constructors.py b/pandas/tests/series/test_constructors.py index 27cfec0dbf20d..5e08768b89e9b 100644 --- a/pandas/tests/series/test_constructors.py +++ b/pandas/tests/series/test_constructors.py @@ -1185,3 +1185,11 @@ def test_constructor_range_dtype(self, dtype): expected = Series([0, 1, 2, 3, 4], dtype=dtype or 'int64') result = Series(range(5), dtype=dtype) tm.assert_series_equal(result, expected) + + def test_constructor_tz_aware_and_tz_naive_data(self): + # GH 13051 + dt_list = [Timestamp('2016-05-01 02:03:37'), + Timestamp('2016-04-30 19:03:37-0700', tz='US/Pacific')] + result = Series(dt_list) + expected = Series(dt_list, dtype=object) + tm.assert_series_equal(result, expected) From 1af397bff457876cc83aff0f8109628adfb690eb Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Sat, 23 Jun 2018 10:31:01 -0700 Subject: [PATCH 3/6] add whatsnew --- doc/source/whatsnew/v0.23.2.txt | 6 +----- doc/source/whatsnew/v0.24.0.txt | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/doc/source/whatsnew/v0.23.2.txt b/doc/source/whatsnew/v0.23.2.txt index ff872cfc6b3ef..ceb96c25e9c28 100644 --- a/doc/source/whatsnew/v0.23.2.txt +++ b/doc/source/whatsnew/v0.23.2.txt @@ -93,11 +93,7 @@ Bug Fixes - Bug in :class:`Timestamp` and :class:`DatetimeIndex` where passing a :class:`Timestamp` localized after a DST transition would return a datetime before the DST transition (:issue:`20854`) - Bug in comparing :class:`DataFrame`s with tz-aware :class:`DatetimeIndex` columns with a DST transition that raised a ``KeyError`` (:issue:`19970`) -- Bug in :meth:`DatetimeIndex.shift` where an ``AssertionError`` would raise when shifting across DST (:issue:`8616`) -- Bug in :class:`Timestamp` constructor where passing an invalid timezone offset designator (``Z``) would not raise a ``ValueError``(:issue:`8910`) -- Bug in :meth:`Timestamp.replace` where replacing at a DST boundary would retain an incorrect offset (:issue:`7825`) -- Bug in :meth:`DatetimeIndex.reindex` when reindexing a tz-naive and tz-aware :class:`DatetimeIndex` (:issue:`8306`) -- Bug in :meth:`DatetimeIndex.resample` when downsampling across a DST boundary (:issue:`8531`) + **Other** diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index 90fc579ae69e5..57be2ca080038 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -171,9 +171,18 @@ Timedelta Timezones ^^^^^^^^^ -- -- -- +- Bug in :meth:`DatetimeIndex.shift` where an ``AssertionError`` would raise when shifting across DST (:issue:`8616`) +- Bug in :class:`Timestamp` constructor where passing an invalid timezone offset designator (``Z``) would not raise a ``ValueError``(:issue:`8910`) +- Bug in :meth:`Timestamp.replace` where replacing at a DST boundary would retain an incorrect offset (:issue:`7825`) +- Bug in :meth:`DatetimeIndex.reindex` when reindexing a tz-naive and tz-aware :class:`DatetimeIndex` (:issue:`8306`) +- Bug in :meth:`DatetimeIndex.resample` when downsampling across a DST boundary (:issue:`8531`) +- Bug when indexing :class:`DatetimeIndex` with nanosecond resolution dates and timezones (:issue:`11679`) +- Bug in :class:`DataFrame` when setting values with ``loc`` and a timezone aware :class:`DatetimeIndex` (:issue:`11365`) +- Bug in :class:`Timestamp` when passing different string date formats with a timezone offset would produce different timezone offsets (:issue:`12064`) +- Bug when comparing a tz-naive :class:`Timestamp` to a tz-aware :class:`DatetimeIndex` which would coerce the :class:`DatetimeIndex` to tz-naive (:issue:`12601`) +- Bug in :meth:`Series.truncate` with a tz-aware :class:`DatetimeIndex` which would cause a core dump (:issue:`9243`) +- Bug in :meth:`Series.replace` with ``datetime64[ns, tz]`` data when replacing ``NaT`` (:issue:`11792`) +- Bug in :class:`Series` constructor which would coerce tz-aware and tz-naive :class:`Timestamp`s to tz-aware (:issue:`13051`) Offsets ^^^^^^^ From ed1209b37da159d43d28967dfe2761cbf165e30a Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Mon, 25 Jun 2018 22:21:00 -0700 Subject: [PATCH 4/6] Address review --- pandas/conftest.py | 13 ++++--------- pandas/tests/frame/test_indexing.py | 18 ++---------------- .../tests/indexes/datetimes/test_arithmetic.py | 4 ++++ pandas/tests/indexes/datetimes/test_ops.py | 8 -------- pandas/tests/indexing/test_datetime.py | 14 ++++++++++++++ pandas/tests/series/test_constructors.py | 2 +- pandas/tests/series/test_replace.py | 16 +++++++--------- 7 files changed, 32 insertions(+), 43 deletions(-) diff --git a/pandas/conftest.py b/pandas/conftest.py index 56473971d9c70..d457b66b070aa 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -1,5 +1,3 @@ -import operator - import pytest import numpy as np @@ -253,14 +251,11 @@ def any_int_dtype(request): return request.param -COMPARISON_OPERATORS = [operator.lt, operator.le, operator.eq, operator.ne, - operator.ge, operator.gt] - - -@pytest.fixture(params=COMPARISON_OPERATORS) -def comparison_fixture(request): +@pytest.fixture(params=['__eq__', '__ne__', '__le__', + '__lt__', '__ge__', '__gt__']) +def all_compare_operators(request): """ - Parameterized fixture for comparison operators. + Fixture for dunder names for common compare operations * >= * > diff --git a/pandas/tests/frame/test_indexing.py b/pandas/tests/frame/test_indexing.py index 87263f1fd60a3..c7aaf900b17fa 100644 --- a/pandas/tests/frame/test_indexing.py +++ b/pandas/tests/frame/test_indexing.py @@ -1688,20 +1688,6 @@ def test_getitem_list_duplicates(self): expected = df.iloc[:, 2:] assert_frame_equal(result, expected) - def test_getitem_setitem_datetimeindex_tz(self): - # GH 11679 - data = ['2016-06-28 08:30:00.123456789'] - index = DatetimeIndex(data, dtype='datetime64[ns, America/Chicago]') - df = DataFrame({'a': [10]}, index=index) - result = df.loc[df.index[0]] - expected = Series(10, index=['a'], name=df.index[0]) - tm.assert_series_equal(result, expected) - - result = df.copy() - result.loc[df.index[0], 'a'] = -1 - expected = DataFrame(-1, index=index, columns=['a']) - tm.assert_frame_equal(result, expected) - def test_get_value(self): for idx in self.frame.index: for col in self.frame.columns: @@ -2263,9 +2249,9 @@ def test_setitem_datetimelike_with_inference(self): assert_series_equal(result, expected) @pytest.mark.parametrize('idxer', ['var', ['var']]) - @pytest.mark.parametrize('tz', [None, 'UTC']) - def test_setitem_datetimeindex_tz(self, idxer, tz): + def test_setitem_datetimeindex_tz(self, idxer, tz_naive_fixture): # GH 11365 + tz = tz_naive_fixture idx = date_range(start='2015-07-12', periods=3, freq='H', tz=tz) expected = DataFrame(1.2, index=idx, columns=['var']) result = DataFrame(index=idx, columns=['var']) diff --git a/pandas/tests/indexes/datetimes/test_arithmetic.py b/pandas/tests/indexes/datetimes/test_arithmetic.py index 0649083a440df..ff31ffee13217 100644 --- a/pandas/tests/indexes/datetimes/test_arithmetic.py +++ b/pandas/tests/indexes/datetimes/test_arithmetic.py @@ -276,6 +276,10 @@ def test_comparison_tzawareness_compat(self, op): with pytest.raises(TypeError): op(dz, ts) + # GH 12601: Check comparison against Timestamps and DatetimeIndex + with pytest.raises(TypeError): + op(ts, dz) + @pytest.mark.parametrize('op', [operator.eq, operator.ne, operator.gt, operator.ge, operator.lt, operator.le]) diff --git a/pandas/tests/indexes/datetimes/test_ops.py b/pandas/tests/indexes/datetimes/test_ops.py index 468c9999857ee..c6334e70a1d2c 100644 --- a/pandas/tests/indexes/datetimes/test_ops.py +++ b/pandas/tests/indexes/datetimes/test_ops.py @@ -450,14 +450,6 @@ def test_offset_deprecated(self): with tm.assert_produces_warning(FutureWarning): idx.offset = BDay() - def test_ts_datetimeindex_compare_mismatched_tz(self, comparison_fixture): - # GH 12601 - comparison = comparison_fixture - idx = date_range('2016-01-01 12:00', periods=10, - freq='H', tz='Asia/Tokyo') - with pytest.raises(TypeError): - comparison(idx, pd.Timestamp('2016-01-01 08:00')) - class TestBusinessDatetimeIndex(object): diff --git a/pandas/tests/indexing/test_datetime.py b/pandas/tests/indexing/test_datetime.py index a5c12e4152c90..751372380d262 100644 --- a/pandas/tests/indexing/test_datetime.py +++ b/pandas/tests/indexing/test_datetime.py @@ -252,3 +252,17 @@ def test_series_partial_set_period(self): check_stacklevel=False): result = ser.loc[keys] tm.assert_series_equal(result, exp) + + def test_nanosecond_getitem_setitem_with_tz(self): + # GH 11679 + data = ['2016-06-28 08:30:00.123456789'] + index = pd.DatetimeIndex(data, dtype='datetime64[ns, America/Chicago]') + df = DataFrame({'a': [10]}, index=index) + result = df.loc[df.index[0]] + expected = Series(10, index=['a'], name=df.index[0]) + tm.assert_series_equal(result, expected) + + result = df.copy() + result.loc[df.index[0], 'a'] = -1 + expected = DataFrame(-1, index=index, columns=['a']) + tm.assert_frame_equal(result, expected) diff --git a/pandas/tests/series/test_constructors.py b/pandas/tests/series/test_constructors.py index 5e08768b89e9b..fe224436c52e6 100644 --- a/pandas/tests/series/test_constructors.py +++ b/pandas/tests/series/test_constructors.py @@ -1186,7 +1186,7 @@ def test_constructor_range_dtype(self, dtype): result = Series(range(5), dtype=dtype) tm.assert_series_equal(result, expected) - def test_constructor_tz_aware_and_tz_naive_data(self): + def test_constructor_tz_mixed_data(self): # GH 13051 dt_list = [Timestamp('2016-05-01 02:03:37'), Timestamp('2016-04-30 19:03:37-0700', tz='US/Pacific')] diff --git a/pandas/tests/series/test_replace.py b/pandas/tests/series/test_replace.py index 4fdf9e84df0f8..a3b92798879f5 100644 --- a/pandas/tests/series/test_replace.py +++ b/pandas/tests/series/test_replace.py @@ -108,6 +108,13 @@ def test_replace_gh5319(self): pd.Timestamp('20120101')) tm.assert_series_equal(result, expected) + # GH 11792: Test with replacing NaT in a list with tz data + ts = pd.Timestamp('2015/01/01', tz='UTC') + s = pd.Series([pd.NaT, pd.Timestamp('2015/01/01', tz='UTC')]) + result = s.replace([np.nan, pd.NaT], pd.Timestamp.min) + expected = pd.Series([pd.Timestamp.min, ts], dtype=object) + tm.assert_series_equal(expected, result) + def test_replace_with_single_list(self): ser = pd.Series([0, 1, 2, 3, 4]) result = ser.replace([1, 2, 3]) @@ -249,12 +256,3 @@ def test_replace_mixed_types_with_string(self): result = s.replace([2, '4'], np.nan) expected = pd.Series([1, np.nan, 3, np.nan, 4, 5]) tm.assert_series_equal(expected, result) - - @pytest.mark.parametrize('to_replace', [pd.NaT, [np.nan, pd.NaT]]) - def test_replace_with_tz_aware_data(self, to_replace): - # GH 11792 - ts = pd.Timestamp('2015/01/01', tz='UTC') - s = pd.Series([pd.NaT, pd.Timestamp('2015/01/01', tz='UTC')]) - result = s.replace(to_replace, pd.Timestamp.min) - expected = pd.Series([pd.Timestamp.min, ts], dtype=object) - tm.assert_series_equal(expected, result) From 2a0e57fc9721eb7186045baa9b40ded47052984b Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Tue, 26 Jun 2018 19:10:37 -0700 Subject: [PATCH 5/6] Move tz issues under correct whatsnew heading --- doc/source/whatsnew/v0.24.0.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index 3205b46fb534b..691bae62f7682 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -164,12 +164,6 @@ Datetimelike ^^^^^^^^^^^^ - Fixed bug where two :class:`DateOffset` objects with different ``normalize`` attributes could evaluate as equal (:issue:`21404`) -- Bug in :class:`Index` with ``datetime64[ns, tz]`` dtype that did not localize integer data correctly (:issue:`20964`) -- Bug in :meth:`DatetimeIndex.shift` where an ``AssertionError`` would raise when shifting across DST (:issue:`8616`) -- Bug in :class:`Timestamp` constructor where passing an invalid timezone offset designator (``Z``) would not raise a ``ValueError``(:issue:`8910`) -- Bug in :meth:`Timestamp.replace` where replacing at a DST boundary would retain an incorrect offset (:issue:`7825`) -- Bug in :meth:`DatetimeIndex.reindex` when reindexing a tz-naive and tz-aware :class:`DatetimeIndex` (:issue:`8306`) -- Bug in :meth:`DatetimeIndex.resample` when downsampling across a DST boundary (:issue:`8531`) Timedelta ^^^^^^^^^ @@ -193,6 +187,12 @@ Timezones - Bug in :meth:`Series.truncate` with a tz-aware :class:`DatetimeIndex` which would cause a core dump (:issue:`9243`) - Bug in :meth:`Series.replace` with ``datetime64[ns, tz]`` data when replacing ``NaT`` (:issue:`11792`) - Bug in :class:`Series` constructor which would coerce tz-aware and tz-naive :class:`Timestamp`s to tz-aware (:issue:`13051`) +- Bug in :class:`Index` with ``datetime64[ns, tz]`` dtype that did not localize integer data correctly (:issue:`20964`) +- Bug in :meth:`DatetimeIndex.shift` where an ``AssertionError`` would raise when shifting across DST (:issue:`8616`) +- Bug in :class:`Timestamp` constructor where passing an invalid timezone offset designator (``Z``) would not raise a ``ValueError``(:issue:`8910`) +- Bug in :meth:`Timestamp.replace` where replacing at a DST boundary would retain an incorrect offset (:issue:`7825`) +- Bug in :meth:`DatetimeIndex.reindex` when reindexing a tz-naive and tz-aware :class:`DatetimeIndex` (:issue:`8306`) +- Bug in :meth:`DatetimeIndex.resample` when downsampling across a DST boundary (:issue:`8531`) Offsets ^^^^^^^ From 0f63b698b755ab1d9a1136164da26385d93c95e6 Mon Sep 17 00:00:00 2001 From: Jeff Reback Date: Thu, 28 Jun 2018 06:22:00 -0400 Subject: [PATCH 6/6] remove dups --- doc/source/whatsnew/v0.24.0.txt | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index 3842c53e77ef3..1105acda067d3 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -178,21 +178,12 @@ Timezones - Bug in :meth:`DatetimeIndex.shift` where an ``AssertionError`` would raise when shifting across DST (:issue:`8616`) - Bug in :class:`Timestamp` constructor where passing an invalid timezone offset designator (``Z``) would not raise a ``ValueError``(:issue:`8910`) - Bug in :meth:`Timestamp.replace` where replacing at a DST boundary would retain an incorrect offset (:issue:`7825`) -- Bug in :meth:`DatetimeIndex.reindex` when reindexing a tz-naive and tz-aware :class:`DatetimeIndex` (:issue:`8306`) -- Bug in :meth:`DatetimeIndex.resample` when downsampling across a DST boundary (:issue:`8531`) -- Bug when indexing :class:`DatetimeIndex` with nanosecond resolution dates and timezones (:issue:`11679`) -- Bug in :class:`DataFrame` when setting values with ``loc`` and a timezone aware :class:`DatetimeIndex` (:issue:`11365`) +- Bug in :meth:`Series.replace` with ``datetime64[ns, tz]`` data when replacing ``NaT`` (:issue:`11792`) - Bug in :class:`Timestamp` when passing different string date formats with a timezone offset would produce different timezone offsets (:issue:`12064`) - Bug when comparing a tz-naive :class:`Timestamp` to a tz-aware :class:`DatetimeIndex` which would coerce the :class:`DatetimeIndex` to tz-naive (:issue:`12601`) - Bug in :meth:`Series.truncate` with a tz-aware :class:`DatetimeIndex` which would cause a core dump (:issue:`9243`) -- Bug in :meth:`Series.replace` with ``datetime64[ns, tz]`` data when replacing ``NaT`` (:issue:`11792`) - Bug in :class:`Series` constructor which would coerce tz-aware and tz-naive :class:`Timestamp`s to tz-aware (:issue:`13051`) - Bug in :class:`Index` with ``datetime64[ns, tz]`` dtype that did not localize integer data correctly (:issue:`20964`) -- Bug in :meth:`DatetimeIndex.shift` where an ``AssertionError`` would raise when shifting across DST (:issue:`8616`) -- Bug in :class:`Timestamp` constructor where passing an invalid timezone offset designator (``Z``) would not raise a ``ValueError``(:issue:`8910`) -- Bug in :meth:`Timestamp.replace` where replacing at a DST boundary would retain an incorrect offset (:issue:`7825`) -- Bug in :meth:`DatetimeIndex.reindex` when reindexing a tz-naive and tz-aware :class:`DatetimeIndex` (:issue:`8306`) -- Bug in :meth:`DatetimeIndex.resample` when downsampling across a DST boundary (:issue:`8531`) Offsets ^^^^^^^ @@ -226,7 +217,10 @@ Indexing - The traceback from a ``KeyError`` when asking ``.loc`` for a single missing label is now shorter and more clear (:issue:`21557`) - When ``.ix`` is asked for a missing integer label in a :class:`MultiIndex` with a first level of integer type, it now raises a ``KeyError`` - consistently with the case of a flat :class:`Int64Index` - rather than falling back to positional indexing (:issue:`21593`) -- +- Bug in :meth:`DatetimeIndex.reindex` when reindexing a tz-naive and tz-aware :class:`DatetimeIndex` (:issue:`8306`) +- Bug in :class:`DataFrame` when setting values with ``.loc`` and a timezone aware :class:`DatetimeIndex` (:issue:`11365`) +- Bug when indexing :class:`DatetimeIndex` with nanosecond resolution dates and timezones (:issue:`11679`) + - MultiIndex @@ -254,6 +248,7 @@ Groupby/Resample/Rolling ^^^^^^^^^^^^^^^^^^^^^^^^ - Bug in :func:`pandas.core.groupby.GroupBy.first` and :func:`pandas.core.groupby.GroupBy.last` with ``as_index=False`` leading to the loss of timezone information (:issue:`15884`) +- Bug in :meth:`DatetimeIndex.resample` when downsampling across a DST boundary (:issue:`8531`) - -