我试图将时间转换为秒数。我已经研究过Convert timedelta64[ns] column to seconds in Python Pandas DataFrame但该解决方案不起作用。我想可能是线路出了问题
print(sniffTime)
print(type(sniffTime))
产出:
821693000 nanoseconds
<class 'numpy.timedelta64'>
错误
AttributeError: 'numpy.timedelta64' object has no attribute 'total_seconds'
在线:
df['PerSec']=df['PerSec'].div(sniffTime.total_seconds())
您可以将numpy标量转换为^{} ,因此可以使用^{} :
相关问题 更多 >
编程相关推荐