Browse Source

Saving clustered datasets

Petra Lamborn 5 years ago
parent
commit
07ca9e5130
1 changed files with 13 additions and 11 deletions
  1. 13
    11
      py/clustering.py

+ 13
- 11
py/clustering.py View File

80
 print(mdagg.info())
80
 print(mdagg.info())
81
 print(mdagg.describe())
81
 print(mdagg.describe())
82
 # mdf.to_csv('~/windows/Documents/clusters-ward.csv')
82
 # mdf.to_csv('~/windows/Documents/clusters-ward.csv')
83
+print("Saving")
84
+mdf.to_pickle('../data/9-clusters.pkl')
85
+mdagg.to_pickle('../data/9-clusters.agg.pkl')
86
+print("saved")
83
 
87
 
84
 # Algorithm via 
88
 # Algorithm via 
85
 # <https://stackoverflow.com/questions/38153829/custom-cluster-colors-of-scipy-dendrogram-in-python-link-color-func>
89
 # <https://stackoverflow.com/questions/38153829/custom-cluster-colors-of-scipy-dendrogram-in-python-link-color-func>
108
 # )
112
 # )
109
 # plt.show()
113
 # plt.show()
110
 
114
 
111
-sns.set()
112
-
113
-f, axes = plt.subplots(3,3)
114
-print(f)
115
-print(axes)
116
-
117
-for i, c in enumerate(clabs):
118
-    fds = mdagg[mdagg.cluster == c]
119
-    sns.lineplot(x = 'read_time', y = 'kwh_tot_mean', color = cpal[c], ax = axes[i//3][i%3], data = fds)
120
-    axes[i//3][i%3].fill_between(fds.read_time.dt.to_pydatetime(), fds.kwh_tot_CI_low, fds.kwh_tot_CI_high, alpha = 0.1, color = cpal[c])
121
-plt.show()
115
+# sns.set()
116
+# 
117
+# f, axes = plt.subplots(3,3)
118
+# 
119
+# for i, c in enumerate(clabs):
120
+#     fds = mdagg[mdagg.cluster == c]
121
+#     sns.lineplot(x = 'read_time', y = 'kwh_tot_mean', color = cpal[c], ax = axes[i//3][i%3], data = fds)
122
+#     axes[i//3][i%3].fill_between(fds.read_time.dt.to_pydatetime(), fds.kwh_tot_CI_low, fds.kwh_tot_CI_high, alpha = 0.1, color = cpal[c])
123
+# plt.show()