【发布时间】:2017-10-09 05:15:37
【问题描述】:
我有以下df DataFrame (pandas):
attribute
2017-01-01 a
2017-01-01 a
2017-01-05 b
2017-02-01 a
2017-02-10 a
其中第一列是非唯一的datetime 索引,我想每周计算 a 和 b 的数量。如果我尝试df.attribute.resample('W').count() 将会出现错误,因为重复的条目。
我该怎么做?
【问题讨论】: