【发布时间】:2020-06-14 16:11:21
【问题描述】:
我正在尝试将 sniffTime 转换为秒数。我已经看过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())
【问题讨论】: