Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: invalid field format with NaN values #377

Closed
maxcarrel opened this issue Dec 6, 2021 · 3 comments · Fixed by #378
Closed

Regression: invalid field format with NaN values #377

maxcarrel opened this issue Dec 6, 2021 · 3 comments · Fixed by #378
Labels
bug Something isn't working
Milestone

Comments

@maxcarrel
Copy link

I noticed a regression in the way NaN values are handled when working with pandas dataframes. Could it be a result of 500835? The bug is not observed on 1.23.0.

Steps to reproduce:

import pandas as pd
import numpy as np
from influxdb_client import InfluxDBClient
from influxdb_client.client.write_api import SYNCHRONOUS

client = InfluxDBClient(url="http://localhost:8086", token="...", org="...")

write_api = client.write_api(write_options=SYNCHRONOUS)

df = pd.DataFrame({
    'a': np.arange(0.,3.),
    'b': [0., np.nan, 1.],
}).set_index(pd.to_datetime(['2021-01-01 0:00','2021-01-01 0:01','2021-01-01 0:02']))

write_api.write(
    bucket='test',
    record=df,
    data_frame_measurement_name='test',
)

Expected behavior:

Data points successfully written to database.

Actual behavior:

Exception is raised:

ApiException: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json; charset=utf-8', 'X-Platform-Error-Code': 'invalid', 'Date': 'Mon, 06 Dec 2021 17:00:47 GMT', 'Content-Length': '128'})
HTTP response body: {"code":"invalid","message":"unable to parse 'test a=1.0,_EMPTY_LINE_PROTOCOL_PART_ 1609459260000000000': invalid field format"}

Specifications:

  • Client Version: 1.24.0
  • InfluxDB Version: 2.0.7
  • Platform: linux/windows
@bednar bednar added the bug Something isn't working label Dec 7, 2021
@bednar
Copy link
Contributor

bednar commented Dec 7, 2021

Hi @maxcarrel,

I have prepared a fixed version within #378. If you would like to use this fixed version before regular release, please install client via:

pip install git+https://github.com/influxdata/influxdb-client-python.git@fix/serialization

Regards

@maxcarrel
Copy link
Author

Hi @bednar,

Thank you for your reactivity. That's great, I'll wait for the next release then.

Best regards

@bednar
Copy link
Contributor

bednar commented Dec 7, 2021

@maxcarrel, Thank you for your detailed description and I apologize for any problems caused by this regression.

@bednar bednar added this to the 1.25.0 milestone Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants