Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
386 views
in Technique[技术] by (71.8m points)

有关lead(), lag(), 与PythonAPI如何显示脚本文件的执行时间问题?

我想对表中的一列进行上移操作,以填充表中使用moving或mavg留下的Nan值,例如,假设使用mavg(x, 3)后表如下(可能有些偏差):

xx_1
1nan
2nan
3nan
42
54.5
66

那么,我想做的是,将x_1列的值往上移三行,然后使用lead(x_1,3)时,这种用法是不允许的,所以想问问,这样的操作该如何实现?

还有一个问题是,我在使用Python调用DDB脚本文件时,想知道脚本文件中某些语句块的运行时间,在脚本中使用timer后一般该如何输出到Python呢?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

timer是个语句,输出的时间只能在GUI,Console中能看到,使用api是看不到的。如果你想查看某一段脚本的执行时间,并输出到python api,可以尝试使用evalTimer函数

evalTimer(funcs, [count=1])

参数funcs可以指定多个要执行的函数(0参数的函数),count指定重复次数。关于函数的具体使用可以参考在线帮助 https://www.dolphindb.cn/cn/h...

dolphindb中没有lead,lag函数,但是有对应的函数move。move(x_1, -3)能实现你的要求


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...