-
Notifications
You must be signed in to change notification settings - Fork 524
Writting NaN values makes the Client to fail #195
Comments
…ll` in the JSON data see influxdata#195 Adds a new dependency to module `simplejson` but the same effect is difficult to achieve with base module `json` see http://stackoverflow.com/questions/28639953/python-nan-json-encoder
Fixed in #204 |
Hello, Best regards, Traceback (most recent call last): |
Hello,
|
I found a workaround that may be used : replace numpy.nan by None before inserting data:
Best regards |
@julienvienne: Downside is that the conversion to None changes the type to Object. If you have a field in InfluxDB which already has, e.g., float values, and you then insert new data with NaNs, the conversion to None changes the type and InfluxDB throws an error. For example:
@aviau: Maybe you want to open the issue again? |
I've encountered the same error in the latest version. The issue lies in "synop,wmo=7002 tp01h=0i,tp03h=nan 1420585200000000000" where "tp03h=nan" cannot be interpreted by influxdb line protocol. The best solution might be just to omit the nan value field in the line protocol input, like "synop,wmo=7002 tp01h=0i 1420585200000000000". This way, influxdb will put an empty value in that field. Also, we might need to check for "inf" as well since influxdb seems to not support that either. So, maybe we need to check for "np.isfinite()" and omit the value field that is not finite in the line protocol input. |
I have encountered similar error in version 5.0.0. The workaround julienvienne provided works fine except the case when the whole row are all NaN values. |
Writting a
NaN
value makes the Client to fail. Only tested with influxdb08with the DataFrameClient
raises the error
The client tries to write the value
NaN
which is not a valid JSON value. PythonNaN
should be mapped to JSONnull
. This is coherent with the Pandas usage to encode missing data byNaN
The text was updated successfully, but these errors were encountered: