Description
Steps to reproduce:
- Create a pandas Data Frame with non nano seconds timestamps. Set Data Frame with a time column as an index.
- Set the precision to 's' in my case cause timestamps are with seconds precision. Use write api to write it.
- The timestamps will be converted to 1970.
Maybe I am doing something wrong but importing Pandas Data Frames with this API is poorly documented, especially when it comes to pre-existing date columns, which is very common scenario if you need to import Data Frames.
I have failed to find any docs how date should be specified (column name? data type?) in Data Frame. So after consulting code I have found that it actually has to be an index!
Well ok so be it. However I am not very familiar with PeriodIndex, is that common for Time Series Data Frames? I am always using plain int for date stamp column and I can make it an index. So i would fall in else
clause. Despite TO DO that it might be now what I want, it is exactly what I want. Except only if I am using nano second timestamps ;(. I noticed lack of precision
parameter passed to to_datetime
. Patching this solve the issue for me. I could push the change but it bothers me that maybe I am doing something wrong?
Expected behavior:
Data points in influx should use timestamps from time index correctly.
Actual behavior:
All dates are converted to some silly date around 1970
Specifications:
- Client Version:1.20
- InfluxDB Version:2.0.8
- Platform:5.4.0-81-generic 18.04.1-Ubuntu