我有三个数据集,所有数据集都是timedelta64:
Line 2: SyntaxError: near '(order by Score) Rank
from Scores
order by Score desc'
我申请了:
data1
1 17:49:43
2 09:44:37
3 10:45:52
4 12:58:31
5 16:09:18
6 14:42:53
7 16:19:24
8 15:13:03
9 13:56:40
data2
1 17:50:17
2 09:47:09
3 10:46:10
4 13:02:13
5 16:09:16
6 14:46:14
7 16:20:16
8 15:14:15
9 14:04:14
data3
1 00:00:34
2 00:02:32
3 00:00:18
4 00:03:42
5 23:59:58
6 00:03:21
7 00:00:52
8 00:01:12
9 00:07:34
然后,我收到了一个错误:
df_temp = data3['14:00:00' < data1 < '14:50:00'].mean()
我该如何纠正?
答案 0 :(得分:0)
解决此问题的一种方法是转换为秒并只比较整数:
x, y = pd.to_timedelta('14:00:00').seconds, pd.to_timedelta('14:50:00').seconds
df_temp = data3[data1.dt.seconds.between(x, y)].mean()