influxdata / influxdata/influxdb-client-python
query_data_frame returns a list of data frames
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 793
- Forks
- 186
- Avg merge
- 3h 2m
- Merged PRs (30d)
- 1
Description
### 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_
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at query_api().query_data_frame and reproduce the supplied Flux query with the provided Python client example. Compare the returned list of data frames with the expected single data frame and determine what behavior the query produces.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100