-
Notifications
You must be signed in to change notification settings - Fork 524
DataFrame write "nan", "inf" error in influxdb #422
Comments
One workaround for now is to write dataframe to influxdb column-by-column. For each column, dropna().
|
see my proposed fix in pull request #507 |
I agree with this.
@shagru are you talking about the latest version of InfluxDB or influxdb-python ? |
Indeed, we should reject nan, None and inf values. My original proposal was only taking into account nan and None values (detected using pd.isnull()). We should indeed also exclude np.inf .
Do you want me to update my pull request or create a new one from the latest version of the repo ? |
I noticed the InfluxDB server version: 1.4.2 EDIT: Apparently, Could the package in PIP be updated accordingly? :) |
Uh oh!
There was an error while loading. Please reload this page.
see here #195
It seems that in the latest version, if a DataFrame contains nan, inf elements, there will be error when writing to influxdb. The problem is that the line protocol doesn't support "value1=nan" or "value1=inf". You can drop rows containing nan using df.dropna(), but in most of the case, in the same row, you will need to keep those values that are not "nan", so droping an entire row is not ideal. The solution can be to omit the value fields that is "nan" and "inf" (np.isfinite()), something like, changing "value1=0.3, value2=nan, value3=inf" to "value1=0.3". In this way, the influxdb will keep value1, and give value2, and value3 empty values.
The text was updated successfully, but these errors were encountered: