Skip to content

Commit b50076e

Browse files
committed
ENH: Working on getting to merge ready, cleanup. See full commit message
- get rid of Ts class, simplify timestamp creation - rename tzinfo to tz - get rid of deprecated / new offset mapping, will deal with users - add Index.is_unique, check via is_monotonic cython routine - tofreq -> asfreq again - work around numpy refcount bug in Index.append with datetime64 type promotion - fix bug in Index.join with empty indexes - handle legacy DateRange unpickling in BlockManager - date_range/bdate_range factory functions, test refactoring - got rid of all deprecation warnings in test suite, usages of DateRange - fix merge issue? in generate_code.py - attach tz in DatetimeIndex.asobject - failing duplicate timestamp test - _tseries.pyd depends on datetime.pyx
1 parent 5cd9ef6 commit b50076e

34 files changed

+719
-564
lines changed

pandas/core/api.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77

88
from pandas.core.common import isnull, notnull, save, load
99
from pandas.core.format import set_printoptions
10-
from pandas.core.index import (Index, Int64Index, Factor, MultiIndex,
10+
from pandas.core.index import (Index, Int64Index, Factor, MultiIndex,
1111
DatetimeIndex, IntervalIndex)
1212

13+
# deprecated
1314
from pandas.core.daterange import DateRange
14-
from pandas.core.datetools import Ts, Interval
15+
16+
from pandas.core.daterange import date_range, bdate_range
17+
from pandas.core.datetools import Timestamp, Interval
1518

1619
from pandas.core.series import Series, TimeSeries
1720
from pandas.core.frame import DataFrame

pandas/core/common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ def take_1d(arr, indexer, out=None, fill_value=np.nan):
163163
# Cython methods expects 32-bit integers
164164
indexer = np.array(indexer, dtype=np.int32)
165165

166+
indexer = _ensure_int32(indexer)
167+
166168
out_passed = out is not None
167169

168170
if dtype_str in ('int32', 'int64', 'bool'):

pandas/core/daterange.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
from pandas.core.index import DatetimeIndex, Index
44
import pandas.core.datetools as datetools
55

6-
__all__ = ['DateRange']
76

87
#-----------------------------------------------------------------------------
98
# DateRange class
109

11-
class DateRange(DatetimeIndex):
10+
class DateRange(Index):
11+
12+
offset = tzinfo = None
1213

1314
def __new__(cls, start=None, end=None, periods=None,
1415
offset=datetools.bday, time_rule=None,
@@ -24,10 +25,25 @@ def __new__(cls, start=None, end=None, periods=None,
2425
elif 'timeRule' in kwds and kwds['timeRule'] is not None:
2526
offset = datetools._offsetMap[kwds['timeRule']]
2627

27-
return super(DateRange, cls).__new__(cls, start=start, end=end,
28-
periods=periods, offset=offset, tzinfo=tzinfo, name=name,
29-
_deprecated=True, **kwds)
30-
28+
return DatetimeIndex(start=start, end=end,
29+
periods=periods, offset=offset,
30+
tzinfo=tzinfo, name=name, _deprecated=True,
31+
**kwds)
32+
33+
def __setstate__(self, aug_state):
34+
"""Necessary for making this object picklable"""
35+
index_state = aug_state[:1]
36+
offset = aug_state[1]
37+
38+
# for backwards compatibility
39+
if len(aug_state) > 2:
40+
tzinfo = aug_state[2]
41+
else: # pragma: no cover
42+
tzinfo = None
43+
44+
self.offset = offset
45+
self.tzinfo = tzinfo
46+
Index.__setstate__(self, *index_state)
3147

3248
def date_range(start=None, end=None, periods=None, freq='D', tz=None):
3349
"""

0 commit comments

Comments
 (0)