Skip to content

Commit 416f842

Browse files
mroeschkePingviinituutti
authored andcommitted
TST: Empty Series.reindex with tz-aware dtype (pandas-dev#23480)
1 parent 1e67838 commit 416f842

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

doc/source/whatsnew/v0.24.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1198,6 +1198,7 @@ Indexing
11981198
- The traceback from a ``KeyError`` when asking ``.loc`` for a single missing label is now shorter and more clear (:issue:`21557`)
11991199
- 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`)
12001200
- Bug in :meth:`DatetimeIndex.reindex` when reindexing a tz-naive and tz-aware :class:`DatetimeIndex` (:issue:`8306`)
1201+
- Bug in :meth:`Series.reindex` when reindexing an empty series with a ``datetime64[ns, tz]`` dtype (:issue:`20869`)
12011202
- Bug in :class:`DataFrame` when setting values with ``.loc`` and a timezone aware :class:`DatetimeIndex` (:issue:`11365`)
12021203
- ``DataFrame.__getitem__`` now accepts dictionaries and dictionary keys as list-likes of labels, consistently with ``Series.__getitem__`` (:issue:`21294`)
12031204
- Fixed ``DataFrame[np.nan]`` when columns are non-unique (:issue:`21428`)

pandas/tests/series/indexing/test_alter_index.py

+7
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,13 @@ def test_reindex_datetimeindexes_tz_naive_and_aware():
459459
s.reindex(newidx, method='ffill')
460460

461461

462+
def test_reindex_empty_series_tz_dtype():
463+
# GH 20869
464+
result = Series(dtype='datetime64[ns, UTC]').reindex([0, 1])
465+
expected = Series([pd.NaT] * 2, dtype='datetime64[ns, UTC]')
466+
tm.assert_equal(result, expected)
467+
468+
462469
def test_rename():
463470
# GH 17407
464471
s = Series(range(1, 6), index=pd.Index(range(2, 7), name='IntIndex'))

0 commit comments

Comments
 (0)