12345678910111213141516171819202122232425262728293031323334 |
- from util import getQuery
- import pandas as p
- import matplotlib.pyplot as plt
- import seaborn as sns
-
-
- # query = """
- # SELECT *, read_date + CONCAT(period / 2, ':', period %% 2 * 30, ':00')::time AS read_time
- # FROM public.coup_tall_april WHERE icp_id LIKE (%s) AND read_date = to_date(%s, 'dd/mm/yyyy')
- # ORDER BY icp_id, read_time;
- # """
- #
- # qparams = ['%%1117', '20/04/2017']
-
- query = """
- SELECT read_date, period, AVG(kwh_tot) AS average
- FROM public.coup_tall_april
- GROUP BY read_date, period
- ORDER BY read_date, period;
- """
-
- qparams = []
-
- df = getQuery(query, qparams)
-
- print(df.info())
-
- sns.set()
-
- #sns.lineplot(x = 'read_time', y = 'kwh_tot', hue = 'icp_id', data = df)
- sns.lineplot(x = 'period', y = 'average', hue = 'read_date', data = df)
-
- plt.show()
|