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.
Closed
Description
I'm having problems uploading dataframes into InfluxDB, using write_points.
The problem is due to this part of the code:
File _dataframe_client.py
# Make array of timestamp ints
if isinstance(dataframe.index, pd.PeriodIndex):
time = ((dataframe.index.to_timestamp().values.astype(int) /
precision_factor).astype(int).astype(str))
else:
time = ((pd.to_datetime(dataframe.index).values.astype(int) /
precision_factor).astype(int).astype(str))
That int cast doesn't work in my code. I tested just casting datetime's into ints and this is what i get:
In [24]: numpy.datetime64('2016-01-05T00:00:00.000000000').astype(int)
Out[24]: -1226113024
In [25]: numpy.datetime64('2016-01-04T00:00:00.000000000').astype(int)
Out[25]: 630980608
In [26]: numpy.version.version
Out[26]: '1.11.3'
I had to modify the code to cast to np.int64 for it to work (not using PeriodIndex):
# Make array of timestamp ints
if isinstance(dataframe.index, pd.PeriodIndex):
time = ((dataframe.index.to_timestamp().values.astype(int) /
precision_factor).astype(int).astype(str))
else:
time = ((pd.to_datetime(dataframe.index).values.astype(np.int64) /
precision_factor).astype(np.int64).astype(str))
Don't think the cast as coded currently is correct, or a case is missing.
Metadata
Metadata
Assignees
Labels
No labels