Skip to content

Commit 76520d9

Browse files
committed
Merge pull request #11006 from jreback/tzpickle
BUG: Bug in pickling of a non-regular freq DatetimeIndex #11002
2 parents 117e61f + ff3473c commit 76520d9

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

doc/source/whatsnew/v0.17.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ Bug Fixes
913913
- Bug in clearing the cache on ``DataFrame.pop`` and a subsequent inplace op (:issue:`10912`)
914914
- Bug in indexing with a mixed-integer ``Index`` causing an ``ImportError`` (:issue:`10610`)
915915
- Bug in ``Series.count`` when index has nulls (:issue:`10946`)
916-
916+
- Bug in pickling of a non-regular freq ``DatetimeIndex`` (:issue:`11002`)
917917
- Bug causing ``DataFrame.where`` to not respect the ``axis`` parameter when the frame has a symmetric shape. (:issue:`9736`)
918918

919919
- Bug in ``Table.select_column`` where name is not preserved (:issue:`10392`)

pandas/tseries/index.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ def _new_DatetimeIndex(cls, d):
120120
# data are already in UTC
121121
# so need to localize
122122
tz = d.pop('tz',None)
123-
result = cls.__new__(cls, **d)
123+
124+
result = cls.__new__(cls, verify_integrity=False, **d)
124125
if tz is not None:
125126
result = result.tz_localize('UTC').tz_convert(tz)
126127
return result

pandas/tseries/tests/test_timeseries.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -2142,8 +2142,8 @@ def test_period_resample_with_local_timezone_dateutil(self):
21422142

21432143

21442144
def test_pickle(self):
2145-
#GH4606
21462145

2146+
# GH4606
21472147
p = self.round_trip_pickle(NaT)
21482148
self.assertTrue(p is NaT)
21492149

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

2156+
# GH11002
2157+
# don't infer freq
2158+
idx = date_range('1750-1-1', '2050-1-1', freq='7D')
2159+
idx_p = self.round_trip_pickle(idx)
2160+
tm.assert_index_equal(idx, idx_p)
21562161

21572162
def _simple_ts(start, end, freq='D'):
21582163
rng = date_range(start, end, freq=freq)

0 commit comments

Comments
 (0)