Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

dataframe client writes nothing when using json protocol #700

Closed
@d3banjan

Description

@d3banjan

my environment

$ conda list | grep "pandas\|influx"                      
influxdb                  5.2.2                    pypi_0    pypi
pandas                    0.24.1           py36hf484d3e_0    conda-forge
from influxdb import DataFrameClient
import pandas as pd

df = pd.DataFrame(data=dict(
			a=[0,1,2,3],
			b=[50,51,52,53]),
		index=pd.date_range(
			start=pd.to_datetime('2018-01-01'),
			end=pd.to_datetime('2019-01-01'),
			periods=4))

dfi = DataFrameClient(database='testdb')

json_output = dfi._convert_dataframe_to_json(df,'test-measurement')
line_output = dfi._convert_dataframe_to_lines(df,'test-measurement')
print("dataframe payload:\n", df)
print("json output=", json_output)
print("line output=","\n".join(line_output), sep="\n")
  • returns
In [28]: %run ~/Desktop/influx-json-bug.py                                                                                                               
dataframe payload:
                            a   b
2018-01-01 00:00:00+00:00  0  50
2018-05-02 16:00:00+00:00  1  51
2018-09-01 08:00:00+00:00  2  52
2019-01-01 00:00:00+00:00  3  53
json output= []
line output=
test-measurement a=0i,b=50i 1514764800000000000
test-measurement a=1i,b=51i 1525276800000000000
test-measurement a=2i,b=52i 1535788800000000000
test-measurement a=3i,b=53i 1546300800000000000

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions