我想使用Spark(Scala)数据框来做模式和相应的计数的groupby聚合。 例如, 假设我们有以下的数据帧: Category Color Number Letter
1 Red 4 A
1 Yellow Null B
3 Green 8 C
2 Blue Null A
1 Green 9 A
3 Green 8 B
3 Yellow
我在度量的聚合方面遇到问题。 真实世界的情景是,客户想要分析在该周进入商店的客户数量的比例。 我们知道每周输入的客户数量以及购买类型(昂贵,适中,便宜)的购买次数。 由于存在不同的购买类型,因此会为该位置和该周创建多行。因此同样的措施(NumberOfWalkInCustomers)被复制。 These are the records. NumberOfWalkInCustomers are th