diff --git a/RELEASE.rst b/RELEASE.rst index 1f5bd2591470b..e44c2d0d37e08 100644 --- a/RELEASE.rst +++ b/RELEASE.rst @@ -49,6 +49,7 @@ pandas 0.11.1 - support datelike columns with a timezone as data_columns (GH2852_) - table writing performance improvements. - Add modulo operator to Series, DataFrame + - Add ``date`` method to DatetimeIndex **API Changes** @@ -275,7 +276,7 @@ pandas 0.11.0 on rhs (GH3216_) - Treat boolean values as integers (values 1 and 0) for numeric operations. (GH2641_) - - Add ``time()`` method to DatetimeIndex (GH3180_) + - Add ``time`` method to DatetimeIndex (GH3180_) - Return NA when using Series.str[...] for values that are not long enough (GH3223_) - Display cursor coordinate information in time-series plots (GH1670_) diff --git a/pandas/tseries/index.py b/pandas/tseries/index.py index 46e2488fb70e6..a918e9eb18e8b 100644 --- a/pandas/tseries/index.py +++ b/pandas/tseries/index.py @@ -1319,11 +1319,18 @@ def freqstr(self): @property def time(self): """ - Returns array of datetime.time. The time of the day + Returns numpy array of datetime.time. The time part of the Timestamps. """ # can't call self.map() which tries to treat func as ufunc # and causes recursion warnings on python 2.6 - return _algos.arrmap_object(self.asobject, lambda x:x.time()) + return _algos.arrmap_object(self.asobject, lambda x: x.time()) + + @property + def date(self): + """ + Returns numpy array of datetime.date. The date part of the Timestamps. + """ + return _algos.arrmap_object(self.asobject, lambda x: x.date()) def normalize(self): diff --git a/pandas/tseries/tests/test_timeseries.py b/pandas/tseries/tests/test_timeseries.py index 9b20ac1e3f055..beee5caa871c5 100644 --- a/pandas/tseries/tests/test_timeseries.py +++ b/pandas/tseries/tests/test_timeseries.py @@ -1847,6 +1847,12 @@ def test_time(self): expected = [t.time() for t in rng] self.assert_((result == expected).all()) + def test_date(self): + rng = pd.date_range('1/1/2000', freq='12H', periods=10) + result = pd.Index(rng).date + expected = [t.date() for t in rng] + self.assert_((result == expected).all()) + class TestLegacySupport(unittest.TestCase): _multiprocess_can_split_ = True