influxdata / influxdata/influxdb-client-python

query_data_frame returns a list of data frames

未关闭
#589 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug
主要语言
Python
星标
793
派生
186
平均合并
3 小时 2 分钟
30 天内合并 PR
1

描述

Specifications
  • Client Version: 1.36.1
  • InfluxDB Version: 2.71
  • Platform: Linux
Code sample to reproduce problem

Push a series of data and get it back via API query

for i in range(0,600000):
   temperatura += 1
   point = (
   	Point("Postazione1")
   	.tag("TipoTest", 1)
   	.field("Temperatura", temperatura))
   DBresponse = write_api.write(bucket=bucket, org=config.influx_org, record=point)
   time.sleep(.01)

Then get back the data with API AND THE QUERY BELOW

from(bucket: “Bed1”)
|> range(start: 2023-06-22T14:10:36.106Z, stop: 2023-06-22T14:29:12.154Z)
|> filter(fn: (r) => r[“_measurement”] == “Postazione1”)
|> filter(fn: (r) => r[“TipoTest”] == “1”)
|> filter(fn: (r) => r[“_field”] == “Temperatura”)
|> aggregateWindow(every: 1s, fn: mean, createEmpty: false)
|> yield(name: “mean”)
|> pivot(rowKey:[“_time”], columnKey: [“_field”], valueColumn: “_value”)
|> keep(columns:[“_time”, “Temperatura”])

client = InfluxDBClient(url=influx_url, token=influx_token, org=influx_org, debug=False)
df = client.query_api().query_data_frame(org=influx_org, query=query)

For some reason, df is a list of, in my case, 2 data frames so I can access df[0] and df[1]

Why I got 2 data frames and not one?

Expected behavior

Return a single data frame with all the data from my measure

Actual behavior

Return two data frames

Additional info

No response

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 query_api().query_data_frame 开始,使用提供的 Python 客户端示例重现所提供的 Flux 查询。将返回的数据框列表与预期的单个数据框进行比较,并确定该查询产生了什么行为。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
databases
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。