3 如何在dolphindb python api中pivot一个表?

在python中,有如下的dataframe:

  time                 A    B    C      D  E  F
0 2019-12-19 15:00:00  foo  one  small  1  2  2
1 2019-12-19 15:00:30  foo  one  large  2  4  4
2 2019-12-19 15:01:00  foo  one  large  2  5  5
3 2019-12-19 15:01:30  foo  two  small  3  5  5
4 2019-12-19 15:02:00  foo  two  small  3  6  6
5 2019-12-19 15:02:30  bar  one  large  4  6  6
6 2019-12-19 15:03:00  bar  one  small  5  8  8
7 2019-12-19 15:03:30  bar  two  small  6  9  9
8 2019-12-19 15:04:00  bar  two  large  7  9  9

怎么通过dolphindb python orca api把上述dataframe转化成如下dataframe?其中的数字代表每种AE组合D的数量和。

E    2    4    5     6  8    9
A                               
bar  NaN  NaN  NaN   4  5.0  13.0
foo  1.0  2.0  5.0   3  NaN   NaN
请先 登录 后评论

1 个回答

Jason Tang - 时序数据库技术支持

可以参考dolphindb的orca教程:https://gitee.com/dolphindb/Orca/tree/master/totorial_EN

请先 登录 后评论