你写入了 RANGE 分区外的数据(分区是2000-2040年的range分区),RANGE 分区不能够自增,且由于range分区不能往左添加分区,所以需要重新建库。从1980建到2040年吧: RANGE(1980.01M + (0..60)*12)
回答于 21小时前
通过查询 defs() 函数获取相关函数。 use taselect * from defs() where namelike "ta::%"
回答于 2024-05-06 16:49
可以使用 repmat 函数。 m = matrix(1 2 3, 4 5 6)m.rowSum().matrix().repmat(1, m.cols()) #output -- -- 5 5 7 7 9 9
回答于 2024-05-06 16:41
方法一 tb = table(take(`a,10).append!(take(`b,10)) as code, rand(5.,20) as h, rand(5.,20) as c, rand(5.,20) as l, rand(5.,20) as o)def ff(x){ loc=((1..x.size())*4)-1 fx=flatten(x) s=mstd(fx,20) m=mavg(fx,20) return m[loc] ,s[loc]} select *,ff(fixedLengthArrayV...
回答于 2024-05-06 16:38
结合iif + cumsum 可以实现条件累加,如 x = 1..10cumsum(iif(x%2==0, x, 0))上述代码实现了偶数的累加
回答于 2024-05-06 16:04
DolphinDB使用函数式编程的理念,默认情况下不会修改原对象,例如 a= 1 3 2 5 4b = a.sort()print(a)[1,3,2,5,4]print(b)[1,2,3,4,5] 向量a 在sort()函数作用后没有改变,而 sort!(), 即带!的版本会修改原对象。 a.sort!()print(a)[1,2,3,4,5]
回答于 2024-05-06 15:04
编写自定义聚合函数 t = table(1 1 1 1 1 2 2 2 2 2 as id, 1..10 as v)defg myAgg(x){ return sum(x[x<avg(x)])}select myAgg(v) as v from t group by id # output id v -- -- 1 3 2 13
回答于 2024-05-06 11:45