Python Pandas:在保留级别的索引上进行时间重采样

时间:2019-10-31 17:10:29

标签: python pandas

假设一个数据框具有一个多重索引,具有多个级别:site, sensor, timestamp

其列:current, temperature

如何对其进行重新采样,以便汇总列但保留级别。

df = df.resample('15T', level='timestamp').agg({c: agg_func_by_name(c) for c in df.columns}

此后,我看到我的索引仅为timestamp,而其他级别则像docs中的multindex示例一样被折叠。有没有办法控制我的关卡行为?我想了解各个传感器的值。

0 个答案:

没有答案