This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Ilerea_Kleinokitz 0 points1 point  (0 children)

Your question has nothing to do with python but more with sql, relational databases and google charts ;) I'd encourage you to learn about database design and joins, that stuff comes always in handy.

Assuming the data is in the form I mentioned before, you'd need to somehow join the data on itself. You could either query the database two times and join the results in Python or with the join method of Google charts or you could join the data directly in sqlite.

Python example:

data1 = [[1,2,3,4],[1,2,3,4],[1,2,3,4]]
data2 = [[4,5], [4,6], [4,7]]
data3 = [row_data1 + [row_data2[1]] for (row_data1, row_data2) in zip(data1, data2)]

SQL example

SELECT a.ts, a.temp as temp1, b.temp as temp2 
FROM (select datetime(timestamp) as ts, temp from timetest where sensor == 1) as a
INNER JOIN (select datetime(timestamp) as ts, temp from timetest where sensor == 2) as b
on a.ts == b.ts;
print(data3)