请问DolphinDB没有类似于python的切片函数呢?比如我要取间隔5日一次的数据

如题,我有这样一个日期的向量:

attachments-2023-03-MCBP325p64131332952cf.png

我想得到如下的结果:

attachments-2023-03-rLgwUOHm6413134662009.png

请问有办法实现吗?

请先 登录 后评论

2 个回答

Jason Tang - 时序数据库技术支持

可以尝试以下这个方法:

dataVector = 2021.01.01..2021.02.28
dataVector[at(0..(size(dataVector)-1)%5==0)]
请先 登录 后评论
Polly

除上述方法外,还可以通过

方法二:通过 cutPoints 函数,但由于范围包含右边界,需要去掉最后一个数据。

cutPoints(dataVector, ceil(dataVector.size()\5))

方法三:仅 200 版本支持,通过列式元组取数特性实现:

cut(v, 5).setColumnarTuple!()[0]
请先 登录 后评论