pivot的逆操作

使用pivot将窄表转宽表后,怎么进行逆操作

请先 登录 后评论

1 个回答

peter

unpivot可以将宽表转为窄表

参考手册https://www.dolphindb.cn/cn/help/FunctionsandCommands/FunctionReferences/u/unpivot.html?highlight=unpivot

t=table(1..3 as id, 2010.01.01 + 1..3 as time, 4..6 as col1, 7..9 as col2, 10..12 as col3, `aaa`bbb`ccc as col4, `ddd`eee`fff as col5, 'a' 'b' 'c' as col6);
t.unpivot(`id, `col1`col2);

上述代码可以将col1,col2由行转为列


请先 登录 后评论