Permalink
Browse files

ENH/API: add normalize option to DatetimeIndex, date_range, bdate_ran…

…ge. deprecate /remove _normalizeFirst option in offsets. set default for BDay to not normalize, close #1031, #506
  • Loading branch information...
1 parent d988d11 commit 992b1ff5f17a0111a15963cf8387180e368a814a @wesm wesm committed Apr 14, 2012
Showing with 156 additions and 138 deletions.
  1. +7 −0 RELEASE.rst
  2. +11 −4 pandas/core/daterange.py
  3. +47 −77 pandas/core/datetools.py
  4. +29 −12 pandas/core/index.py
  5. +62 −45 pandas/tests/test_timeseries.py
View
@@ -22,6 +22,13 @@ Where to get it
* Binary installers on PyPI: http://pypi.python.org/pypi/pandas
* Documentation: http://pandas.pydata.org
+pandas 0.8.0
+============
+
+**API Changes**
+
+ - Change BDay (business day) to not normalize dates by default
+
pandas 0.7.3
============
View
@@ -43,7 +43,8 @@ def __setstate__(self, aug_state):
self.tzinfo = tzinfo
Index.__setstate__(self, *index_state)
-def date_range(start=None, end=None, periods=None, freq='D', tz=None):
+def date_range(start=None, end=None, periods=None, freq='D', tz=None,
+ normalize=False):
"""
Return a fixed frequency datetime index, with day (calendar) as the default
frequency
@@ -53,23 +54,29 @@ def date_range(start=None, end=None, periods=None, freq='D', tz=None):
----------
start :
end :
+ normalize : bool, default False
+ Normalize start/end dates to midnight before generating date range
Returns
-------
"""
return DatetimeIndex(start=start, end=end, periods=periods,
- freq=freq, tz=tz)
+ freq=freq, tz=tz, normalize=normalize)
-def bdate_range(start=None, end=None, periods=None, freq='B', tz=None):
+def bdate_range(start=None, end=None, periods=None, freq='B', tz=None,
+ normalize=True):
"""
Return a fixed frequency datetime index, with business day as the default
frequency
Parameters
----------
+ normalize : bool, default False
+ Normalize start/end dates to midnight before generating date
+ range. Defaults to True for legacy reasons
Returns
-------
@@ -78,7 +85,7 @@ def bdate_range(start=None, end=None, periods=None, freq='B', tz=None):
"""
return DatetimeIndex(start=start, end=end, periods=periods,
- freq=freq, tz=tz)
+ freq=freq, tz=tz, normalize=normalize)
def interval_range():
"""
Oops, something went wrong.

0 comments on commit 992b1ff

Please sign in to comment.