Python 在Google云库中操作时间序列数据
我试图使用Google Cloud Python库从自定义Stackdriver度量中获取数据,但除了将其作为数据帧返回外,我无法获取所需的值 例如查询,它看起来像:Python 在Google云库中操作时间序列数据,python,google-cloud-platform,stackdriver,google-cloud-python,Python,Google Cloud Platform,Stackdriver,Google Cloud Python,我试图使用Google Cloud Python库从自定义Stackdriver度量中获取数据,但除了将其作为数据帧返回外,我无法获取所需的值 例如查询,它看起来像: query = client.query(metric_type, minutes=5) 当使用pandas时,返回如下内容: resource_type l7_lb_rule project_id
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()
我如何筛选它,以便它显示我需要的数据
或者可能我不应该将其显示为数据帧,我只是不知道如何使用此库获取此数据
提前感谢我决定完全避免使用数据帧,只需迭代timeseries对象即可提取所需的值。如果您只想查看数据,应该使用云控制台,因为它有一些很好的数据过滤方法。如果您正在对日志进行处理,我建议使用接收器将它们写入bigquery,然后查询并将数据从bigquery加载到数据帧中。