【发布时间】:2019-10-19 15:03:37
【问题描述】:
enter image description hereenter image description here
图像包含一个以机器 ID 和时间实例为列的数据集,我必须计算机器每天工作的总时间。
【问题讨论】:
-
请将示例数据复制粘贴到您的问题中
标签: dataframe time-series data-science
enter image description hereenter image description here
图像包含一个以机器 ID 和时间实例为列的数据集,我必须计算机器每天工作的总时间。
【问题讨论】:
标签: dataframe time-series data-science
试试这样的..
t1 = pd.to_datetime('1/1/2015 01:00')
t2 = pd.to_datetime('1/1/2015 03:30')
#in seconds
print pd.Timedelta(t2 - t1).seconds / 3600.0
#in hours
print pd.Timedelta(t2 - t1).seconds / 60.0
【讨论】: