Browse Source

Fix matplotlib errors; download the sample data

Petra Lamborn 5 years ago
parent
commit
427fca640c
2 changed files with 8 additions and 40 deletions
  1. 2
    0
      py/clustering.py
  2. 6
    40
      py/downkwh.py

+ 2
- 0
py/clustering.py View File

@@ -1,6 +1,8 @@
1 1
 from util import getQuery, pickleQuery
2 2
 import numpy as np
3 3
 import pandas as p
4
+import matplotlib
5
+matplotlib.use('agg')
4 6
 import matplotlib.pyplot as plt
5 7
 import seaborn as sns
6 8
 from scipy.spatial.distance import squareform

+ 6
- 40
py/downkwh.py View File

@@ -1,47 +1,13 @@
1 1
 from util import getQuery, pickleQuery, getkwh
2 2
 import pandas as p
3
-import matplotlib.pyplot as plt
4
-import seaborn as sns
3
+# import matplotlib
4
+# matplotlib.use('agg')
5
+# import matplotlib.pyplot as plt
6
+# import seaborn as sns
5 7
 
6
-# query = """
7
-# SELECT comb.icp_id, comb.read_time, COALESCE(kwh_tot, 0) AS kwh_tot
8
-# FROM
9
-# (
10
-#     SELECT read_time, icp_id
11
-#     FROM
12
-#     (
13
-#         SELECT read_time 
14
-#         FROM GENERATE_SERIES('2017-01-01 00:30:00'::timestamp, '2017-02-01 00:00:00'::timestamp, 
15
-#             '30 minutes'::interval) read_time
16
-#     ) AS tsdata CROSS JOIN
17
-#     (
18
-#         SELECT *
19
-#         FROM
20
-#         (
21
-#             SELECT icp_id, COUNT(DISTINCT read_date) AS data_days 
22
-#             FROM coup_prd.coupdatamaster
23
-#             WHERE read_date >= to_date('01/01/2017','dd/mm/yyyy')
24
-#                 AND read_date <  to_date('01/01/2018','dd/mm/yyyy')
25
-#                 AND content_code = 'UN'
26
-#                 AND icp_id LIKE '%%19'
27
-#             GROUP BY icp_id
28
-#         ) AS cir 
29
-#         WHERE data_days >= 360
30
-#     ) AS qual_icp
31
-# ) AS comb
32
-# LEFT JOIN
33
-# (
34
-#     SELECT *, read_date + CONCAT(period / 2, ':', period %% 2 * 30, ':00')::time AS read_time
35
-#     FROM public.coup_tall_jan
36
-# ) AS tall_timestamp 
37
-# ON comb.read_time = tall_timestamp.read_time AND comb.icp_id = tall_timestamp.icp_id;
38
-# """
39
-# 
40
-# pickleQuery(query, "../data/jan19s.pkl")
41
-
42
-kwhdata = getkwh('2018-01-01', '2018-04-01', '2018-01-01 00:30:00', '2018-04-01 00:00:00', '%%1')
8
+kwhdata = getkwh('2017-01-01', '2018-01-01', '2017-01-01 00:30:00', '2018-01-01 00:00:00', '%%1')
43 9
 
44 10
 print(kwhdata.info())
45 11
 
46 12
 print("Pickling")
47
-kwhdata.to_pickle("../data/2018-proj-sample.pkl")
13
+kwhdata.to_pickle("../data/2017-sample.pkl")