Skip to content

Commit

Permalink
BUG: Bug in pickling of a non-regular freq DatetimeIndex pandas-dev#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback authored and Nick Eubank committed Sep 29, 2015
1 parent cfde297 commit f690b10
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.17.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ Bug Fixes
- Bug in clearing the cache on ``DataFrame.pop`` and a subsequent inplace op (:issue:`10912`)
- Bug in indexing with a mixed-integer ``Index`` causing an ``ImportError`` (:issue:`10610`)
- Bug in ``Series.count`` when index has nulls (:issue:`10946`)

- Bug in pickling of a non-regular freq ``DatetimeIndex`` (:issue:`11002`)
- Bug causing ``DataFrame.where`` to not respect the ``axis`` parameter when the frame has a symmetric shape. (:issue:`9736`)

- Bug in ``Table.select_column`` where name is not preserved (:issue:`10392`)
Expand Down
3 changes: 2 additions & 1 deletion pandas/tseries/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ def _new_DatetimeIndex(cls, d):
# data are already in UTC
# so need to localize
tz = d.pop('tz',None)
result = cls.__new__(cls, **d)

result = cls.__new__(cls, verify_integrity=False, **d)
if tz is not None:
result = result.tz_localize('UTC').tz_convert(tz)
return result
Expand Down
7 changes: 6 additions & 1 deletion pandas/tseries/tests/test_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -2142,8 +2142,8 @@ def test_period_resample_with_local_timezone_dateutil(self):


def test_pickle(self):
#GH4606

# GH4606
p = self.round_trip_pickle(NaT)
self.assertTrue(p is NaT)

Expand All @@ -2153,6 +2153,11 @@ def test_pickle(self):
self.assertTrue(idx_p[1] is NaT)
self.assertTrue(idx_p[2] == idx[2])

# GH11002
# don't infer freq
idx = date_range('1750-1-1', '2050-1-1', freq='7D')
idx_p = self.round_trip_pickle(idx)
tm.assert_index_equal(idx, idx_p)

def _simple_ts(start, end, freq='D'):
rng = date_range(start, end, freq=freq)
Expand Down

0 comments on commit f690b10

Please sign in to comment.