在 ols() 中使用 group by 子句并在 DolphinDB 中接收 "getMember method not supported"
use group by clause with ols() and receive "getMember method not supported" in DolphinDB
我在 ols() 函数示例中遵循了 groupby 用法,但收到错误消息:不支持 getMember 方法。
这是DolphinDB手册提供的例子:
def myols(y,x) {
r=ols(y,x,true,2)
return r.Coefficient.beta join r.RegressionStat.statistics[0]
}
select myols(y,(factor1,factor2)) as `int`factor1`factor2`R2 from t group by id;
这是我写的:
def myols(y,x) {
r=ols(y,x,true,2)
return r.RegressionStat.statistics[1]
}
select myols(price, volume) as r2 from t1 group by date, wind_code
抛出异常时可以使用try…catch()和returndouble()
t1 = select * from table_raw where date>2021.12.08
def myols(y,x) {
r=ols(y,x,true,2)
try {return r.RegressionStat.statistics[1]} catch(ex) {return double()}
}
select myols(price, volume) as r2 from t1 group by date, wind_code
我在 ols() 函数示例中遵循了 groupby 用法,但收到错误消息:不支持 getMember 方法。
这是DolphinDB手册提供的例子:
def myols(y,x) {
r=ols(y,x,true,2)
return r.Coefficient.beta join r.RegressionStat.statistics[0]
}
select myols(y,(factor1,factor2)) as `int`factor1`factor2`R2 from t group by id;
这是我写的:
def myols(y,x) {
r=ols(y,x,true,2)
return r.RegressionStat.statistics[1]
}
select myols(price, volume) as r2 from t1 group by date, wind_code
抛出异常时可以使用try…catch()和returndouble()
t1 = select * from table_raw where date>2021.12.08
def myols(y,x) {
r=ols(y,x,true,2)
try {return r.RegressionStat.statistics[1]} catch(ex) {return double()}
}
select myols(price, volume) as r2 from t1 group by date, wind_code