maxframe.dataframe.Series.dt.date#
- Series.dt.date#
返回 Python
datetime.date对象的 numpy 数组。即不带时间和时区信息的时间戳中的日期部分。
参见
DatetimeIndex.timeReturns numpy array of
datetime.timeobjects. The time part of the Timestamps.DatetimeIndex.yearThe year of the datetime.
DatetimeIndex.monthThe month as January=1, December=12.
DatetimeIndex.dayThe day of the datetime.
示例
对于 Series:
>>> import maxframe.dataframe as md >>> s = md.Series(["1/1/2020 10:00:00+00:00", "2/1/2020 11:00:00+00:00"]) >>> s = md.to_datetime(s) >>> s.execute() 0 2020-01-01 10:00:00+00:00 1 2020-02-01 11:00:00+00:00 dtype: datetime64[us, UTC] >>> s.dt.date.execute() 0 2020-01-01 1 2020-02-01 dtype: object
对于 DatetimeIndex:
>>> idx = md.DatetimeIndex( ... ["1/1/2020 10:00:00+00:00", "2/1/2020 11:00:00+00:00"] ... ) >>> idx.date.execute() array([datetime.date(2020, 1, 1), datetime.date(2020, 2, 1)], dtype=object)