'Index' object has no attribute 'to_datetime'

在计算回撤的时候想要
将时间转换时间数据
代码如下:periods = (temp.index[1:].to_datetime()-temp.index[:-1].to_datetime())
出现报错提醒: 'Index' object has no attribute 'to_datetime'

index是啥类型啊,没有to_datetime这个函数啊