1

I am using influxdb v2.0.9 with python and am wondering why values are not equal when reading them out again.

I.e. I am writing a value 0.000007345345 into the db but when I read them out I get 0.0000073 and the other digits are cut off.

I use the following code to read out the data:

query = 'from(bucket:"mybucket")\
|> range(start: -12h)\
|> filter(fn:(r) => r._measurement == "myData")'
result = client.query_api().query_data_frame(query, org=org)
final_frame = pd.DataFrame(data=result["_time"])
final_frame["value"] = result["_value"]

print(final_frame)

In influxdb's data explorer on the website I can see all digits when doing a query.

Any idea what is missing in my query to get the value including all digits?

UPDATE:

Meanwhile I found the solution. I have to define the default precision in pandas then I can see all the digits.

pd.set_option("display.precision", 10)
lurker
  • 56,987
  • 9
  • 69
  • 103
Martin S
  • 377
  • 3
  • 14
  • 1
    Are the missing digits really missing or just not displayed? How do you check it? – dlask Oct 30 '21 at 14:06
  • In the db the digits are not missing but when reading them with this method query_data_frame() the digits are missing. When I use the standard query() method then the digits arenot missing but the result is harder to process because it is not a pandas frame. – Martin S Oct 30 '21 at 20:39
  • 1
    what if you print `your_value - 0.0000073`? Or `your_value / 0.0000073`? Those should indicate if it's a display issue as @dlask suggests or if you have actually lost precision. – ramzeek Oct 30 '21 at 20:44
  • Yes, you are right. After doing value * 1000 I could see that the missing digits are there. – Martin S Oct 30 '21 at 20:58

0 Answers0