Skip to content

TST/CLN: Old timezone issues PT3 #21674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion doc/source/whatsnew/v0.24.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ Timezones
- Bug in :meth:`Series.truncate` with a tz-aware :class:`DatetimeIndex` which would cause a core dump (:issue:`9243`)
- 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 :class:`DatetimeIndex` where constructing with an integer and tz would not localize correctly (:issue:`12619`)
- Bug in :func:`DataFrame.fillna` where a ``ValueError`` would raise when one column contained a ``datetime64[ns, tz]`` dtype (:issue:`15522`)

Offsets
^^^^^^^
Expand Down Expand Up @@ -326,7 +328,7 @@ Sparse
Reshaping
^^^^^^^^^

-
- Bug in :func:`pandas.concat` when joining resampled DataFrames with timezone aware index (:issue:`13783`)
-
-

Expand Down
11 changes: 11 additions & 0 deletions pandas/tests/frame/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,17 @@ def test_fillna(self):
pd.Timestamp('2012-11-11 00:00:00+01:00')]})
assert_frame_equal(df.fillna(method='bfill'), exp)

# with timezone in another column
# GH 15522
df = pd.DataFrame({'A': pd.date_range('20130101', periods=4,
tz='US/Eastern'),
'B': [1, 2, np.nan, np.nan]})
result = df.fillna(method='pad')
expected = pd.DataFrame({'A': pd.date_range('20130101', periods=4,
tz='US/Eastern'),
'B': [1., 2., 2., 2.]})
assert_frame_equal(result, expected)

def test_na_actions_categorical(self):

cat = Categorical([1, 2, 3, np.nan], categories=[1, 2, 3])
Expand Down
7 changes: 7 additions & 0 deletions pandas/tests/indexes/datetimes/test_construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,13 @@ def test_constructor_with_int_tz(self, klass, box, tz, dtype):
expected = klass([ts])
assert result == expected

def test_construction_int_rountrip(self, tz_naive_fixture):
# GH 12619
tz = tz_naive_fixture
result = 1293858000000000000
expected = DatetimeIndex([1293858000000000000], tz=tz).asi8[0]
assert result == expected


class TestTimeSeries(object):

Expand Down
9 changes: 9 additions & 0 deletions pandas/tests/reshape/test_concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2351,6 +2351,15 @@ def test_concat_datetime_timezone(self):

tm.assert_frame_equal(result, expected)

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


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