Skip to content

Commit 992b1ff

Browse files
committed
ENH/API: add normalize option to DatetimeIndex, date_range, bdate_range. deprecate /remove _normalizeFirst option in offsets. set default for BDay to not normalize, close #1031, #506
1 parent d988d11 commit 992b1ff

File tree

5 files changed

+156
-138
lines changed

5 files changed

+156
-138
lines changed

RELEASE.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ Where to get it
2222
* Binary installers on PyPI: http://pypi.python.org/pypi/pandas
2323
* Documentation: http://pandas.pydata.org
2424

25+
pandas 0.8.0
26+
============
27+
28+
**API Changes**
29+
30+
- Change BDay (business day) to not normalize dates by default
31+
2532
pandas 0.7.3
2633
============
2734

pandas/core/daterange.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def __setstate__(self, aug_state):
4343
self.tzinfo = tzinfo
4444
Index.__setstate__(self, *index_state)
4545

46-
def date_range(start=None, end=None, periods=None, freq='D', tz=None):
46+
def date_range(start=None, end=None, periods=None, freq='D', tz=None,
47+
normalize=False):
4748
"""
4849
Return a fixed frequency datetime index, with day (calendar) as the default
4950
frequency
@@ -53,23 +54,29 @@ def date_range(start=None, end=None, periods=None, freq='D', tz=None):
5354
----------
5455
start :
5556
end :
57+
normalize : bool, default False
58+
Normalize start/end dates to midnight before generating date range
5659
5760
Returns
5861
-------
5962
6063
"""
6164
return DatetimeIndex(start=start, end=end, periods=periods,
62-
freq=freq, tz=tz)
65+
freq=freq, tz=tz, normalize=normalize)
6366

6467

65-
def bdate_range(start=None, end=None, periods=None, freq='B', tz=None):
68+
def bdate_range(start=None, end=None, periods=None, freq='B', tz=None,
69+
normalize=True):
6670
"""
6771
Return a fixed frequency datetime index, with business day as the default
6872
frequency
6973
7074
Parameters
7175
----------
7276
77+
normalize : bool, default False
78+
Normalize start/end dates to midnight before generating date
79+
range. Defaults to True for legacy reasons
7380
7481
Returns
7582
-------
@@ -78,7 +85,7 @@ def bdate_range(start=None, end=None, periods=None, freq='B', tz=None):
7885
"""
7986

8087
return DatetimeIndex(start=start, end=end, periods=periods,
81-
freq=freq, tz=tz)
88+
freq=freq, tz=tz, normalize=normalize)
8289

8390
def interval_range():
8491
"""

0 commit comments

Comments
 (0)