Python Pandas – 如何对指定频率的DateTimeIndex执行ceil操作
要在指定频率的DateTimeIndex上执行ceil操作,请使用 DateTimeIndex.ceil() 方法 。使用 freq 参数设置频率。
首先导入所需的库−
使用周期为5,频率为秒(S)的DatetimeIndex创建。时区为Australia/Adelaide −
显示DateTimeIndex−
针对指定频率的DateTimeIndex日期执行Ceil操作−
更多Pandas文章,请阅读:Pandas教程
示例
以下是代码−
输出结果
这将产生以下代码 −