Skip to content

PR for Pandas issue #14872 / fillna() TZ datetime64 rounded #14905

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

Closed
wants to merge 10 commits into from
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.19.2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Other Enhancements
Bug Fixes
~~~~~~~~~

- Bug in fillna() in which timezone aware datetime64 values were incorrectly rounded (:issue:'14872')
- Compat with ``dateutil==2.6.0``; segfault reported in the testing suite (:issue:`14621`)
- Allow ``nanoseconds`` in ``Timestamp.replace`` as a kwarg (:issue:`14621`)
- Bug in ``pd.read_csv`` in which aliasing was being done for ``na_values`` when passed in as a dictionary (:issue:`14203`)
Expand Down
21 changes: 21 additions & 0 deletions pandas/tests/series/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

from .common import TestData

import datetime
import pytz


def _skip_if_no_pchip():
try:
Expand Down Expand Up @@ -908,6 +911,24 @@ def test_interp_timedelta64(self):
index=pd.to_timedelta([1, 2, 4]))
assert_series_equal(result, expected)

# GH 14872
def test_dtype_utc():
Copy link
Contributor

Choose a reason for hiding this comment

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

needs to take self


data = pd.Series([pd.NaT, pd.NaT,
datetime.datetime(2016, 12, 12, 22, 24, 6, 100001,
tzinfo=pytz.utc)])

filled = data.fillna(method='bfill')

expected = pd.Series([
datetime.datetime(2016, 12, 12, 22, 24, 6,
100001, tzinfo=pytz.utc),
datetime.datetime(2016, 12, 12, 22, 24, 6,
100001, tzinfo=pytz.utc),
datetime.datetime(2016, 12, 12, 22, 24, 6,
100001, tzinfo=pytz.utc)])

assert_series_equal(filled, expected)

if __name__ == '__main__':
import nose
Expand Down
34 changes: 0 additions & 34 deletions pandas/tests/test_dtype_utc.py

This file was deleted.