Skip to content

BUG: use entire size of DatetimeTZBlock when coercing result (#15855) #15924

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 4 commits into from
Apr 7, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 14 additions & 0 deletions pandas/tests/frame/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,20 @@ def test_fillna(self):
result = df.fillna(value={'Date': df['Date2']})
assert_frame_equal(result, expected)

# with timezone
# GH 15855
df = pd.DataFrame({'A': [pd.Timestamp('2012-11-11 00:00:00+01:00'),
pd.NaT]})
exp = pd.DataFrame({'A': [pd.Timestamp('2012-11-11 00:00:00+01:00'),
pd.Timestamp('2012-11-11 00:00:00+01:00')]})
self.assert_frame_equal(df.fillna(method='pad'), exp)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to not use self. here, just assert_frame_equal (or tm.assert_frame_equal).


df = pd.DataFrame({'A': [pd.NaT,
pd.Timestamp('2012-11-11 00:00:00+01:00')]})
exp = pd.DataFrame({'A': [pd.Timestamp('2012-11-11 00:00:00+01:00'),
pd.Timestamp('2012-11-11 00:00:00+01:00')]})
self.assert_frame_equal(df.fillna(method='bfill'), exp)

def test_fillna_downcast(self):
# GH 15277
# infer int64 from float64
Expand Down
8 changes: 0 additions & 8 deletions pandas/tests/indexes/datetimes/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,3 @@ def test_fillna_datetime64(self):
pd.Timestamp('2011-01-01 11:00', tz=tz)],
dtype=object)
self.assert_index_equal(idx.fillna('x'), exp)

def test_fillna_timezone(self):
# GH 15855
df = pd.DataFrame({'A': [pd.Timestamp('2012-11-11 00:00:00+01:00'),
pd.NaT]})
exp = pd.DataFrame({'A': [pd.Timestamp('2012-11-11 00:00:00+01:00'),
pd.Timestamp('2012-11-11 00:00:00+01:00')]})
self.assert_frame_equal(df.fillna(method='pad'), exp)
12 changes: 12 additions & 0 deletions pandas/tests/series/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,18 @@ def test_datetime64_tz_fillna(self):
self.assert_series_equal(expected, result)
self.assert_series_equal(pd.isnull(s), null_loc)

# with timezone
# GH 15855
df = pd.Series([pd.Timestamp('2012-11-11 00:00:00+01:00'), pd.NaT])
exp = pd.Series([pd.Timestamp('2012-11-11 00:00:00+01:00'),
pd.Timestamp('2012-11-11 00:00:00+01:00')])
self.assert_series_equal(df.fillna(method='pad'), exp)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too :>


df = pd.Series([pd.NaT, pd.Timestamp('2012-11-11 00:00:00+01:00')])
exp = pd.Series([pd.Timestamp('2012-11-11 00:00:00+01:00'),
pd.Timestamp('2012-11-11 00:00:00+01:00')])
self.assert_series_equal(df.fillna(method='bfill'), exp)

def test_datetime64tz_fillna_round_issue(self):
# GH 14872

Expand Down