Skip to content

Regression: invalid field format with NaN values #377

Closed
@maxcarrel

Description

@maxcarrel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions