maxframe.dataframe.DataFrame.at_time#

DataFrame.at_time(time, axis=0)#

选择一天中特定时间的值(例如,上午9:30)。

参数:
  • time (datetime.time or str) -- 要选择的值。

  • axis ({0 or 'index', 1 or 'columns'}, default 0) -- 对于 Series 此参数未使用,默认为 0。

返回类型:

Series or DataFrame

抛出:

TypeError -- 如果索引不是 DatetimeIndex

参见

between_time

选择一天中特定时间段之间的值。

first

基于日期偏移选择时间序列的初始时间段。

last

基于日期偏移选择时间序列的最终时间段。

DatetimeIndex.indexer_at_time

获取一天中特定时间值的索引位置。

示例

>>> import maxframe.dataframe as md
>>> i = md.date_range('2018-04-09', periods=4, freq='12h')
>>> ts = md.DataFrame({'A': [1, 2, 3, 4]}, index=i)
>>> ts.execute()
                     A
2018-04-09 00:00:00  1
2018-04-09 12:00:00  2
2018-04-10 00:00:00  3
2018-04-10 12:00:00  4
>>> ts.at_time('12:00').execute()
                     A
2018-04-09 12:00:00  2
2018-04-10 12:00:00  4