我每小时都有一个分组值的熊猫数据框
2020.05.05 17:00:00 cpu_usage_specint 4.354603
phys_iops 3075.779680
total_memory 13843.480000
2020.05.05 18:00:00 cpu_usage_specint 3.670237
phys_iops 3403.007340
...
2020.05.11 22:00:00 phys_iops 30459.577340
total_memory 28851.025000
2020.05.11 23:00:00 cpu_usage_specint 1.903852
phys_iops 8161.811320
total_memory 28827.575000
the index is a MultiIndex([('2020.05.05 17:00:00', 'cpu_usage_specint'),
('2020.05.05 17:00:00', 'phys_iops'),
('2020.05.05 17:00:00', 'total_memory'),
('2020.05.05 18:00:00', 'cpu_usage_specint'),
('2020.05.05 18:00:00', 'phys_iops'),
('2020.05.05 18:00:00', 'total_memory'),
('2020.05.05 19:00:00', 'cpu_usage_specint'),
('2020.05.05 19:00:00', 'phys_iops'),
('2020.05.05 19:00:00', 'total_memory'),
('2020.05.05 20:00:00', 'cpu_usage_specint'),
...
('2020.05.11 20:00:00', 'total_memory'),
('2020.05.11 21:00:00', 'cpu_usage_specint'),
('2020.05.11 21:00:00', 'phys_iops'),
('2020.05.11 21:00:00', 'total_memory'),
('2020.05.11 22:00:00', 'cpu_usage_specint'),
('2020.05.11 22:00:00', 'phys_iops'),
('2020.05.11 22:00:00', 'total_memory'),
('2020.05.11 23:00:00', 'cpu_usage_specint'),
('2020.05.11 23:00:00', 'phys_iops'),
('2020.05.11 23:00:00', 'total_memory')],
例如,我想要每小时每个指标的特定值
for date in metrics_pivot_df.index.get_level_values('date').unique():
print('this is the date',date)
这给了我日期,但我也想要说 total_memory 的值,所以我可以进行一些测试,例如 >= 等,但是我不知道如何获得该值?我尝试过引用“mertic”列,但是当我尝试进行查询时,这会返回真/假
非常感谢任何帮助