influxdb-python icon indicating copy to clipboard operation
influxdb-python copied to clipboard

Imprecise timestamp added with write_points

Open lifeisawavesorideit opened this issue 4 years ago • 1 comments

  • InfluxDB version: e.g. 1.7.6
  • InfluxDB-python version: e.g. 5.3.0
  • Python version: e.g. 3.7.4
  • Operating system version: Windows 10

I'm having issues with the precision of the timestamp in nanoseconds when trying to save it to the InfluxDB.

The last 3 rows of my dataframe look as follows:

Timestamp Value 2019-10-09 11:20:38.253 260.30697 2019-10-09 11:20:38.255 260.44757 2019-10-09 11:20:38.257 260.59392

where the Timestamp is set as index with df.index = pd.to_datetime(df.index, unit='ns').

When writing the endpoints to Influx the timestamps with write_points() I obtain following data inserted: 1570620038252999936 260.30697 1570620038255000064 260.44757 1570620038256999936 260.59392

There seems to be someting wrong when writing the data to the InfluxDB. The expected results should look something like: 1570620038253000000 260.30697 1570620038255000000 260.44757 1570620038257000000 260.59392

lifeisawavesorideit avatar Apr 29 '20 07:04 lifeisawavesorideit

@lifeisawavesorideit thanks for opening! should be fixed with the attached PR!

russorat avatar May 08 '20 16:05 russorat