Python Pandas – 返回特定时间段内DateTimeIndex中的值的索引位置
要返回特定时间段内DateTimeIndex中的值的索引位置,请使用 DateTimeIndex.indexer_between_time() 方法。
首先,导入所需的库−
创建一个周期为5、频率为T(即分)的DatetimeIndex。时区为Australia / Adelaide−
显示DateTimeIndex−
显示特定时间段内的值的索引位置。 “start_time”设置为’02: 30: 50’,”end_time”设置为’03: 20: 50−
示例
以下是代码−
输出
程序会产生以下代码−