Skip to content

Commit a89d991

Browse files
committed
ENH: legacy time rule support and refactoring, better alias handling. misc tests, #1041
1 parent 33f515a commit a89d991

8 files changed

+392
-494
lines changed

pandas/core/daterange.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,14 @@ def __new__(cls, start=None, end=None, periods=None,
1919
warnings.warn("DateRange is deprecated, use DatetimeIndex instead",
2020
FutureWarning)
2121

22-
# use old mapping
22+
if time_rule is None:
23+
time_rule = kwds.get('timeRule')
2324
if time_rule is not None:
24-
offset = datetools._offset_map[time_rule]
25-
elif 'timeRule' in kwds and kwds['timeRule'] is not None:
26-
offset = datetools._offset_map[kwds['timeRule']]
25+
offset = datetools.get_offset(time_rule)
2726

2827
return DatetimeIndex(start=start, end=end,
2928
periods=periods, offset=offset,
30-
tzinfo=tzinfo, name=name, _deprecated=True,
31-
**kwds)
29+
tzinfo=tzinfo, name=name, **kwds)
3230

3331
def __setstate__(self, aug_state):
3432
"""Necessary for making this object picklable"""

0 commit comments

Comments
 (0)