我正在尝试使用Google-Cloud Python库从自定义Stackdriver指标中获取数据,但除了将其作为pandas数据帧返回之外,我无法获得所需的值。
例如查询,类似于:
query = client.query(metric_type, minutes=5)
当使用pandas时返回如下内容:
resource_type l7_lb_rule
project_id my_id
backend_name
backend_zone
forwarding_rule_name foo-http foo-https
instance_group_name
matched_url_path_rule
target_proxy_name foo-target-1 foo-https-060417
target_proxy_type
url_map_name foo foo
log requests requests
2017-06-26 15:43:06.750 26 25
然而,我不确定如何操纵它来获取我需要的值,这实际上是http和https请求的数量(我想总结这些)。
例如,如果我使用iterrows()
,我该如何过滤掉它,以便向我展示我需要的数据?
或者将其显示为数据框并不是我应该如何做到这一点,我只是不知道如何使用此库获取此数据。
提前致谢
答案 0 :(得分:0)
我决定完全避免使用数据帧,只是遍历timeseries对象来提取我需要的值。