我有一个时间序列数据框。我有兴趣按[column1,column2]的组绘制时间累积总和。到目前为止,我只能在组合存在的点处绘制累积总和。我想要的是原始数据框中每个时间戳的每个组的累积总和,因此我可以轻松地在同一个图上绘制总累积总和作为组累积总和。
[编辑]我为此感兴趣,对于我感兴趣的每个小组:
values = np.where((df.column1==someVal) & (df.column2==someVal), df.column3, 0).cumsum()
plt.plot(df.timestamp, values)
values = np.where((df.column1==someVal) & (df.column2==someVal), df.column3, 0).cumsum()
plt.plot(df.timestamp, values)