maxframe.dataframe.Series.dt.time#

Series.dt.time#

返回 datetime.time 对象的 numpy 数组。

时间戳中的时间部分。

参见

DatetimeIndex.timetz

Returns numpy array of datetime.time objects with timezones. The time part of the Timestamps.

DatetimeIndex.date

Returns numpy array of python datetime.date objects. Namely, the date part of Timestamps without time and timezone information.

示例

对于 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.time.execute()
0    10:00:00
1    11:00:00
dtype: object

对于 DatetimeIndex:

>>> idx = md.DatetimeIndex(
...     ["1/1/2020 10:00:00+00:00", "2/1/2020 11:00:00+00:00"]
... )
>>> idx.time.execute()
array([datetime.time(10, 0), datetime.time(11, 0)], dtype=object)