官网的move示例有些疑惑,为什么8:21:01和8:21:02的结果是1 1 不应该是395吗

x=3 9 5 1 4 9;

index = (second(08:20:00)+1..4) join 08:21:01 join 08:21:02

x = index.indexedSeries(x)

move(x,3s)

attachments-2023-12-iGeEcyFO657c15e8bfbf9.png


请先 登录 后评论

最佳答案 2023-12-18 09:55

对于 x 中每个时间T i,向前偏移 window 后为T i - window, 返回T i - window 对应的 X 中的元素,若 T 中无对应时间,则返回T i - window 前一个临近时间对应的 X 中的元素。具体可参考tmove — DolphinDB 2.0 documentation

T = (second(08:20:00)+1..4) join 08:21:01 join 08:21:02
X = 3 9 5 1 4 9
m = table(T as t,X as x)
select *, tmove(t, x, 3s) from m

返回结果:

t	    x	    tmove_t
08:20:01	3	
08:20:02	9	
08:20:03	5	
08:20:04	1	3
08:21:01	4	1
08:21:02	9	1


请先 登录 后评论

其它 0 个回答

  • 1 关注
  • 0 收藏,278 浏览
  • vayne 提出于 2023-12-15 17:06

相似问题