矩阵转化为表时会丢失行标签。先通过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()).rename!(`date`code`Price) t
date code Price
---------- -------- -----
2022.10.18 sh600000 1
2022.10.19 sh600000
2022.10.20 sh600000
2022.10.18 sh600002
2022.10.19 sh600002 2
2022.10.20 sh600002
2022.10.18 sh600003
2022.10.19 sh600003
2022.10.20 sh600003 3