pandas.DatetimeIndex.indexer_at_time#
- DatetimeIndex.indexer_at_time(time, asof=False)[源代码]#
返回一天中特定时间的索引位置。
- Parameters:
- timedatetime.time 或 str
时间可以作为对象(datetime.time)或字符串(以适当的格式,如 “H:M”、”H%M”、”I:M%p”、”I%M%p”、”H:M:S”、”H%M%S”、”I:M:S%p”、”I%M%S%p”)传入。
- Returns:
- np.ndarray[np.intp]
参见
indexer_between_time获取一天中特定时间段内的值的索引位置。
DataFrame.at_time选择一天中特定时间的值。
Examples
>>> idx = pd.DatetimeIndex(["1/1/2020 10:00", "2/1/2020 11:00", ... "3/1/2020 10:00"]) >>> idx.indexer_at_time("10:00") array([0, 2])