Skip to content

Commit 823478c

Browse files
mroeschkejreback
authored andcommitted
TST/CLN: Old timezone issues PT3 (#21674)
1 parent be14333 commit 823478c

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

doc/source/whatsnew/v0.24.0.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ Timezones
254254
- Bug in :meth:`Series.truncate` with a tz-aware :class:`DatetimeIndex` which would cause a core dump (:issue:`9243`)
255255
- Bug in :class:`Series` constructor which would coerce tz-aware and tz-naive :class:`Timestamp`s to tz-aware (:issue:`13051`)
256256
- Bug in :class:`Index` with ``datetime64[ns, tz]`` dtype that did not localize integer data correctly (:issue:`20964`)
257+
- Bug in :class:`DatetimeIndex` where constructing with an integer and tz would not localize correctly (:issue:`12619`)
258+
- Bug in :func:`DataFrame.fillna` where a ``ValueError`` would raise when one column contained a ``datetime64[ns, tz]`` dtype (:issue:`15522`)
257259

258260
Offsets
259261
^^^^^^^
@@ -332,7 +334,7 @@ Sparse
332334
Reshaping
333335
^^^^^^^^^
334336

335-
-
337+
- Bug in :func:`pandas.concat` when joining resampled DataFrames with timezone aware index (:issue:`13783`)
336338
-
337339
-
338340

pandas/tests/frame/test_missing.py

+11
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,17 @@ def test_fillna(self):
300300
pd.Timestamp('2012-11-11 00:00:00+01:00')]})
301301
assert_frame_equal(df.fillna(method='bfill'), exp)
302302

303+
# with timezone in another column
304+
# GH 15522
305+
df = pd.DataFrame({'A': pd.date_range('20130101', periods=4,
306+
tz='US/Eastern'),
307+
'B': [1, 2, np.nan, np.nan]})
308+
result = df.fillna(method='pad')
309+
expected = pd.DataFrame({'A': pd.date_range('20130101', periods=4,
310+
tz='US/Eastern'),
311+
'B': [1., 2., 2., 2.]})
312+
assert_frame_equal(result, expected)
313+
303314
def test_na_actions_categorical(self):
304315

305316
cat = Categorical([1, 2, 3, np.nan], categories=[1, 2, 3])

pandas/tests/indexes/datetimes/test_construction.py

+7
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,13 @@ def test_constructor_with_int_tz(self, klass, box, tz, dtype):
496496
expected = klass([ts])
497497
assert result == expected
498498

499+
def test_construction_int_rountrip(self, tz_naive_fixture):
500+
# GH 12619
501+
tz = tz_naive_fixture
502+
result = 1293858000000000000
503+
expected = DatetimeIndex([1293858000000000000], tz=tz).asi8[0]
504+
assert result == expected
505+
499506

500507
class TestTimeSeries(object):
501508

pandas/tests/reshape/test_concat.py

+9
Original file line numberDiff line numberDiff line change
@@ -2351,6 +2351,15 @@ def test_concat_datetime_timezone(self):
23512351

23522352
tm.assert_frame_equal(result, expected)
23532353

2354+
# GH 13783: Concat after resample
2355+
with catch_warnings(record=True):
2356+
result = pd.concat([df1.resample('H').mean(),
2357+
df2.resample('H').mean()])
2358+
expected = pd.DataFrame({'a': [1, 2, 3] + [np.nan] * 3,
2359+
'b': [np.nan] * 3 + [1, 2, 3]},
2360+
index=idx1.append(idx1))
2361+
tm.assert_frame_equal(result, expected)
2362+
23542363

23552364
@pytest.mark.parametrize('pdt', [pd.Series, pd.DataFrame, pd.Panel])
23562365
@pytest.mark.parametrize('dt', np.sctypes['float'])

0 commit comments

Comments
 (0)