假设一个数据框具有一个多重索引,具有多个级别: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示例一样被折叠。有没有办法控制我的关卡行为?我想了解各个传感器的值。