mhxiang
mhxiang

性别: 注册于 2021-12-09

向TA求助
15金币数
1230 经验值
0个粉丝
主页被访问 2151 次

63 个回答

0 赞同

根据nextN字段,取P列从当前行开始第nextN行的P值和从当前行开始...

取第nextN行的P值用下标索引,取未来nextN行记录中的最大值可以使用dolphindb的eachRight函数和loop函数实现 p = 100..105 nextN = 1 2 3 1 1 1 tb=select * ,p[ nextN + til(p.size())] as nextNp,eachRight(def(x,range)->x.subarray(range).max(), p, loop(pair, 1..p.size(), 1..p.size() + nextN)) as mmaxnextN...

回答于 2022-11-24 17:36

0 赞同

如果一个函数算出来一个数组,有多个变量返回,比如100个变量,...

可以通过元编程sqlColAlias实现 sql(sqlColAlias(makeCall(ff,sqlCol(`s)),`a+string(1..60)),table(rand(1.0,10) as s)).eval() a1 a2 a3 a4 a5 a6 ... ----------------- ----------------- ----------------- -----------...

回答于 2022-11-24 11:06

0 赞同

取一个表某一列的第n行的值 怎么写呢

通过tb[`col][2]获取b列的第3行 tb=table(rand(1.,50) as a,rand(2.,50) as b,rand(2.,50) as c) tb[`b][2] print(tb[`b][2])

回答于 2022-11-24 10:51

0 赞同

表中如何插入含空值的新数据

用replaceColumn把AskPriceBook和AskVolumeBook转化为DOUBLE[] 再append 例 result = table(10:0, `SecurityID`BidPriceBook`AskPriceBook `BidVolumeBook`AskVolumeBook`Time, [SYMBOL,DOUBLE[], DOUBLE[], INT[], INT[], TIME]) SecurityID = string(100000) BidPriceBook = array(DOUBLE[], 0, 20).append!([1.4799 1....

回答于 2022-11-24 10:10

0 赞同

如何生成xn * n / 10多个式子相加的元代码

可以使用binaryExpr和unifiedExpr实现以上的功能 n=10 colNames=`wd_nBidPrice+string(1..n) weights=1..n\10 weights_ = array(ANY, size(weights)).fill!(1..size(weights)-1, weights) selects = sqlColAlias(unifiedExpr(binaryExpr(sqlCol(colNames), weights_, *), take(+, size(weights)-1)), "weightedSum"); sql...

回答于 2022-11-15 17:20

0 赞同

非空值按一定的规律怎么实现按前值填充?

可以使用ffill实现前值填充,如下 date=2022.01.01+1..50 factor=1..50*1.0 code =take(`A`B,50) select date,code,factor,ffill(iif(0..(size(date)-1) in (5*(0..(size(date)/5))),factor,NULL)) from table(date,code,factor) context by code date code factor ffill ---------- ---- ------ ----- 2022.01.02...

回答于 2022-11-03 16:39

0 赞同

dolphindb中如何实现python中的join方法,将序列中的元素以指定...

在dolphindb中可以通过concat函数实现,动态生成字符数组可以通过each实现 concat(each(x->string(x)+`D,1..5),',') 1D,2D,3D,4D,5D

回答于 2022-10-20 09:32

1 赞同

dolphindb中矩阵如何转化为按行、列和值组成的三列数据的表

矩阵转化为表时会丢失行标签。先通过join把行标签连接起来,再用unpivot t = table(2022.10.18 2022.10.19 2022.10.20 as Date, `sh600000`sh600002`sh600003 as Code, 1.0 2.0 3.0 as Price) m = exec Price from t pivot by Date, Code t=table(m.rowNames() as date) join table(m) t=t.unpivot(`date, m.colNames(...

回答于 2022-10-19 14:39

0 赞同

for循环用sqlColAlias写元代码,在 for 循环里没有解析

用each动态对元代码中的变量赋值 dim=10 T=1000 select_cols=each(def(x,T):sqlColAlias(<sum(class==x)\float(T)>,"L_"+string(x)),0..(dim-1),take(T,dim))

回答于 2022-10-10 17:13

0 赞同

dolphindb中表如何实现重置索引,如何实现pandas的reindex功能

可以通过dolphindb的lj函数实现重置索引。 如果重置的索引标签在原 表 中不存在,那么该标签对应的元素值将全部填充为 NULL。 如原始表如下 tb=table(sort(take(09:30:00+0..6*1200,10)) as time,take(`100000`600000,10) as code,rand(10.,10) as price) 需要按如下的时间对每只code重置索引 total_time=09:30:00+0....

回答于 2022-10-10 10:55