-
Notifications
You must be signed in to change notification settings - Fork 524
DataFrameClient issue - seems does not process correctly DateTimeIndex dates #479
Comments
I confirm the issue. So I propose the following modification: # Make array of timestamp ints
if isinstance(dataframe.index, pd.PeriodIndex):
time = ((dataframe.index.to_timestamp().values.astype(np.int64) /
precision_factor).astype(int).astype(str))
else:
time = ((pd.to_datetime(dataframe.index).values.astype(np.int64) /
precision_factor).astype(np.int64).astype(str)) As a side note, from a performance point of view, direct casting seems to be more performant. For example with a DataFrame with 1 million rows: %timeit (pd.to_datetime(dataframe.index).values.astype(np.int64) / 1e9).astype(np.int64).astype(str)
%timeit str(np.int64(np.int64(pd.to_datetime(dataframe.index).values) / 1e9))
|
…to Unix Epoch (e.g .on (some?) Windows machines)
…erted to Unix Epoch (e.g .on (some?) Windows machines)
It seems that it is related to the number of bits used by the conversion to int (32 bits VS 64bits). Two remaining questions:
|
I've just made a cleaner pull request here : #507 |
I am also facing the same error. I tried the following code:
I got the following error: The above code is working fine at influxdb of version 1.3 but in 1.5 i am getting the above error |
@mousumipaul side note : your question is not related to the original issue of this post :-) |
@patrickhoebeke |
Uh oh!
There was an error while loading. Please reload this page.
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
That int cast doesn't work in my code. I tested just casting datetime's into ints and this is what i get:
I had to modify the code to cast to np.int64 for it to work (not using PeriodIndex):
Don't think the cast as coded currently is correct, or a case is missing.
The text was updated successfully, but these errors were encountered: