0

我正在尝试使用 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()我如何过滤它以便向我显示我需要的数据?

或者也许将它显示为数据框不是我应该做的,我只是看不到如何使用这个库获取这些数据。

提前致谢

4

1 回答 1

0

我决定完全避免使用数据帧,而只是遍历时间序列对象以提取我需要的值。

于 2017-07-05T17:53:08.297 回答