diff --git a/netZooPy/condor/condor.py b/netZooPy/condor/condor.py index 92f7d9a9..9d234ccd 100644 --- a/netZooPy/condor/condor.py +++ b/netZooPy/condor/condor.py @@ -304,8 +304,8 @@ def matrices(self, c,resolution): # Computes weighted biadjacency matrix. A = np.matrix(np.zeros((p, q))) - for edge in self.net.itertuples(index=False): - A[gn[edge[1]], rg[edge[0]]] = edge[2] + for edge in self.net.iterrows(): + A[gn[edge[1].iloc[1]], rg[edge[1].iloc[0]]] = edge[1].iloc[2] # Computes node degrees for the nodesets. ki = A.sum(1) diff --git a/recipe/recipe.yaml b/recipe/recipe.yaml index c7b73c93..f8d2a1cb 100644 --- a/recipe/recipe.yaml +++ b/recipe/recipe.yaml @@ -1,6 +1,6 @@ package: name: netzoopy - version: "0.10.9" + version: "0.11.0" source: path: .. diff --git a/tests/test_cobra.py b/tests/test_cobra.py index f5c12108..4a11b53c 100644 --- a/tests/test_cobra.py +++ b/tests/test_cobra.py @@ -39,6 +39,6 @@ def test_cobra(): q = psi.shape[0] X_mean = np.mean(X.to_numpy(), axis=0) for i in range(q): - C = Q.to_numpy().dot(X_mean[i] * np.diag(psi.to_numpy()[i, :])).dot(Q.to_numpy().T) - C_gt = Q_gt.to_numpy().dot(X_mean[i] * np.diag(psi_gt.to_numpy()[i, :])).dot(Q_gt.to_numpy().T) + C = Q.to_numpy().dot(np.mean(X, axis=0).iloc[i] * np.diag(psi.to_numpy()[i, :])).dot(Q.to_numpy().T) + C_gt = Q_gt.to_numpy().dot(np.mean(X, axis=0).iloc[i] * np.diag(psi_gt.to_numpy()[i, :])).dot(Q_gt.to_numpy().T) pd.testing.assert_frame_equal(pd.DataFrame(C), pd.DataFrame(C_gt), rtol=1e-10, check_exact=False)