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

timestamp rounding error dataframe client #885

Open
svhb1000 opened this issue Apr 15, 2021 · 2 comments
Open

timestamp rounding error dataframe client #885

svhb1000 opened this issue Apr 15, 2021 · 2 comments

Comments

@svhb1000
Copy link

As continuation of #811
The solution for the rounding error seems not to be merged.

This gives particular problems when merging data from different sources to a database : timestamps must be CORRECT! This is an essential point in a timeseries database. (my thoughts...)

python 3 makes floats if you divide with '/' --> please change to '//'

Example : line 375 fro _dataframe_client.py

            time = ((dataframe.index.to_timestamp().values.astype(np.int64) /
                     precision_factor).astype(np.int64).astype(str))

to

            time = ((dataframe.index.to_timestamp().values.astype(np.int64) //
                     precision_factor).astype(np.int64).astype(str))

@cuxcrider
Copy link

cuxcrider commented May 7, 2021

@svhb1000 which version of pandas are you using? I am on 1.2.4 and using the code I posted in #811 I've been testing this without success. Even with the '//' if I have timestamps that are within a few nanoseconds of each other they are combined into one datapoint upon writing to influx.

Edit: my mistake, it is working once I change to '//'. Do you also change the line below line 375 to '//' or should that be left as a single '/'?

@svhb1000
Copy link
Author

svhb1000 commented May 7, 2021

The change is needed in both places. Everywhere the timestamp is converted to a float by the '/' in python 3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants