Petra Lamborn hace 5 años
padre
commit
c4a946c333
Se han modificado 1 ficheros con 5 adiciones y 5 borrados
  1. 5
    5
      py/clustering.py

+ 5
- 5
py/clustering.py Ver fichero

13
     cols = df.columns
13
     cols = df.columns
14
     ncols = len(cols)
14
     ncols = len(cols)
15
     cdf = p.DataFrame(index = cols, columns = cols)
15
     cdf = p.DataFrame(index = cols, columns = cols)
16
-    for c in tqdm(range(ncols)):
17
-        cind = cols[c]
18
-        cdf.loc[cind, cind] = 1
19
-        # for i in range(c + 1, ncols):
20
-        #     print("ZZZ")
16
+    for c in tqdm(cols):
17
+        cdf.loc[c, c] = 0
18
+    comb = combinations(cols, 2)
19
+    for c1, c2 in tqdm(comb):
20
+        cdf.loc[c1, c2] = 1 - df[c1].corr(df[c2])
21
     return cdf
21
     return cdf
22
 
22
 
23
 
23