You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 29, 2024. It is now read-only.
I'm not a Python InfluxDB client developer, but it seems to me like you're missing the "fields" dict in your JSON. The JSON should have the following structure:
{
"measurement": "the name of your measurements table",
"tags": {"tag1": "value1", ...},
"fields": {"field1": "value1", ...},
"time": "timestamp in RFC3339 format"
}
The "time" timestamp is optional (if absent, the current time string is used) and so is the "tags" dict, but "fields" and "measurement" are mandatory. The traceback even gives you a hint :).
I found similar information at http://influxdb-python.readthedocs.io/en/latest/examples.html on the tutorials - basic example. But for tutorials - pandas, field values are not specified like that, only the dataframe and tags are passed into write_points function.
Reading on issue, #362 , using tag_columns parameter instead of tags solved the issue:
client.write_points(df, tbName, tag_columns=['COLUMN1'], protocol='json')
I did not find any documentation supporting this, but it works!
Uh oh!
There was an error while loading. Please reload this page.
Hello,
I'm in need of some help with inserting a df into influxdb.
My code:
Output:
On write_points I get the exception:
If i run write_points without tags: client.write_points(df, tbName, protocol='json')
Execution completed but only one line is inserted.
Without setting the index I just get:
TypeError: Must be DataFrame with DatetimeIndex or PeriodIndex.
.csv file is just 3 lines:
I searched around, but no similar issues, #549 has the same error but different context.
Using python 2.7 and influxdb 5.0
The text was updated successfully, but these errors were encountered: