【发布时间】:2020-07-27 15:53:03
【问题描述】:
我有交易表,
id transaction_date status
1 2020-01-01 Shipped
2 2020-02-01 Shipped
3 2020-02-01 Cancelled
我希望将其转换为 excel 中的数据透视表,如下所示
Date SHIPPED CANCELLED PROCESSING
2020-01-01 1 0 0
2020-02-01 1 1 0
我完全没有办法解决这个问题。我应该使用什么功能?
【问题讨论】:
-
您可以使用
case处理条件,但语法比下面的sum(status='whatever')更笨拙