#!/usr/bin/env python3 import pandas as pd import matplotlib.pyplot as plt import matplotlib.ticker as ticker import matplotlib.dates as mpl_dates import seaborn as sns import database_driver # Handle date time conversions between pandas and matplotlib from pandas.plotting import register_matplotlib_converters register_matplotlib_converters() dbname = 'sensorsData.db' db = database_driver.database(dbname) sns.set() con = db.create_connection() dfFloor = pd.read_sql_query( 'SELECT timestamp, temperature, humidity FROM DHT_data WHERE sensor=1 ORDER BY timestamp', con, parse_dates=['timestamp'], index_col=['timestamp']) dfDesk = pd.read_sql_query( 'SELECT timestamp, temperature, humidity FROM DHT_data WHERE sensor=2 ORDER BY timestamp', con, parse_dates=['timestamp'], index_col=['timestamp']) con.close()
def __init__(self): self.db = database_driver.database(dbname)