示例代码如下:
def f(t, i) { indCode = t[i][`indCode] indexCode = t[i][`indexCode] code = t[i][`code] dateStart = t[i][`date] dateEnd = t[i+1][`date] weight = t[i][`weight] totalMV = t[i][`totalMV] pholding = t[i][`pholding] jr = t[i][`jr] if(isNull(dateEnd)) { days = dateStart } // 表示最后一条 else { days = dateStart..(dateEnd - 1) } days = days[weekday(days) between 1:5] return cj(table(indCode as indCode, indexCode as indexCode, code as code, weight as weight, totalMV as totalMV, pholding as pholding, jr as jr), table(days as date)) } t = table(`35412`35412`35412 as indCode, `H30356.SH`H30356.SH`H30356.SH as indexCode, `000001.SZ`000001.SZ`000001.SZ as code, 2014.06.30 2014.09.30 2014.12.31 as date, 0.0168 0.0153 0.0158 as weight, 1111111111 2222222222 3333333333 as totalMV, 0.0015 0.0013 0.0009 as pholding, 1 1 1 as jr) unionAll(each(f{t}, 1..size(t) - 1), false)
转换前:
转换后(部分数据展示):