Dolphindb 以海豚为单位计算各组的百分比
在DolphinDB中,是否有一种方便的方法来计算组中每个项目的百分比 例如:Dolphindb 以海豚为单位计算各组的百分比,dolphindb,Dolphindb,在DolphinDB中,是否有一种方便的方法来计算组中每个项目的百分比 例如: groupID x percentage 1 1 0.25 1 1 0.25 1 2 0.5 2 4 0.2 2 6 0.3 2 10 0.5 在kdb中,我可以使用fby编写一行代码。我想知道是否有类似的方法在DolphinDB中实现它。在DolphinDB中使用SQL扩展上下文: select groupID, x, x\sum
groupID x percentage
1 1 0.25
1 1 0.25
1 2 0.5
2 4 0.2
2 6 0.3
2 10 0.5
在kdb中,我可以使用
fby
编写一行代码。我想知道是否有类似的方法在DolphinDB中实现它。在DolphinDB中使用SQL扩展上下文:
select groupID, x, x\sum(x) as percentage from t context by groupID