Work with InfluxDB Timestamps

Hi,
I am currently pushing sensor data into my InfluxDB and I am trying to query them and continue to work with them. I would like to compare the data using the timestamp they were delivered to the InfluxDB. Then I want to find the data which have a simular timestamp and work with them as well. I am using python to do so. How do I get access on those timestamps? I can only work with my measurments and not the time.

Thanks in advance and best regards,
Basti

Hello @Basti,
Welcome :slight_smile: I’m having some trouble understanding your question, forgive me.
Are you using the range function to query your data? Can you not access all the data you want with that?
Can you please explain what you mean by have a similar timestamp and work with them as well? Can you share your python and maybe the data you’re able to get and the data you’re not able to get or work with?

This is a guess but it sounds like you’re maybe trying to perform a join? Although if you’re working with python, I’d probably query both datasets and then use pandas for my transformation work.
PS I always like to apply schema.fieldsAsCol() function to my query before converting my data to a pandas dataframe with the client because I find that it’s easier to work with.

Hi @Anaisdg ,
thank you for you reply!
This is my python code which I use to get the sensor’s data from my InfluxDB.

And theses are my query I get. As you see there are two different sensors which give me angles and I am trying to calculate a position of a bluetooth beacon. So I am trying to find simular timestamps in both data lists and then calculate a position out of those two angles, which have a simular timestamp. My problem rightnow is that the querys only have 1 columns. So I have access on the angles but I can’t compare the timestamps of both datasets.

I tried to use the join function, but there is still some mistakes and I can’t solve. Do you have an idea what might be wrong here?

Thank you for your help!

Hello @Basti,
An I see, you’re using InfluxQL and 1.x.
Join is a flux function that only works with 1.8+.

You could do some merges with pandas on the datetimeindex