5 请教一下,我仿照手册里groupby配合ols的方法写了如下语句,报错 =>getMember method not supported

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


请先 登录 后评论

1 个回答

haaha

用try..catch,异常抛出return double()就可以了,如下:

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

请先 登录 后评论
  • 1 关注
  • 0 收藏,305 浏览
  • mhxiang 提出于 2021-12-15 13:19

相似问题