influxdb-python icon indicating copy to clipboard operation
influxdb-python copied to clipboard

FutureWarning on frame.append method

Open lothesven opened this issue 3 years ago • 0 comments

  • InfluxDB version: e.g. 1.7.7 (output of the influx version command)
  • InfluxDB-python version: e.g. 5.2.2 (output of the python -c "from __future__ import print_function; import influxdb; print(influxdb.__version__)" command)
  • Python version: e.g. 3.7.4 (output of the python --version command)
  • Operating system version: e.g. Windows 10, Ubuntu 18.04, macOS 10.14.5

Here is the code:

`client = influxdb_client.InfluxDBClient( url = self.url, token = self.token, org = self.org, timeout = self.timeout, verify_ssl=False)

query_api = client.query_api()

now = dt.datetime.now(tz=dt.timezone.utc) stringTimeStart = now - dt.timedelta(minutes=1) stringTimeStart = stringTimeStart.replace(second=0, microsecond=0) stringTimeStop = now # - dt.timedelta(hours=0) stringTimeStop = stringTimeStop.replace(second=0, microsecond=0)

query = ''' from(bucket: "my-bucket") |> range(start: {stringTimeStart}, stop: {stringTimeStop}) |> filter(fn: (r) => r["_measurement"] == "MeasureName") |> filter(fn: (r) => r["_field"] == "xDef" or r["_field"] == "xDef1" or r["_field"] == "xDef2" or r["_field"] == "xDef3") |> keep(columns: ["_time", "_field", "_value"]) |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value") '''

query = query.format(stringTimeStart=stringTimeStart.isoformat(), stringTimeStop=stringTimeStop.isoformat()) self.last_states = query_api.query_data_frame(query = query)`

Here is the problematic output message :

/home/user/.local/lib/python3.9/site-packages/influxdb_client/client/flux_csv_parser.py:191: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead. return self._data_frame.append(_temp_df)

The script is working properly for now but I am afraid it could be disrupted in the future.

lothesven avatar Jul 25 '22 17:07 lothesven