- API reference
- pandas.DatetimeIndex
- pandas.Datet...
pandas.DatetimeIndex.date#
- propertyDatetimeIndex.date[source]#
Returns numpy array of python
datetime.date
objects.Namely, the date part of Timestamps without time andtimezone information.
Examples
For Series:
>>>s=pd.Series(["1/1/2020 10:00:00+00:00","2/1/2020 11:00:00+00:00"])>>>s=pd.to_datetime(s)>>>s0 2020-01-01 10:00:00+00:001 2020-02-01 11:00:00+00:00dtype: datetime64[ns, UTC]>>>s.dt.date0 2020-01-011 2020-02-01dtype: object
For DatetimeIndex:
>>>idx=pd.DatetimeIndex(["1/1/2020 10:00:00+00:00",..."2/1/2020 11:00:00+00:00"])>>>idx.datearray([datetime.date(2020, 1, 1), datetime.date(2020, 2, 1)], dtype=object)
On this page