From 98dc91bf7f7b7be6084390ca03d0e3d53be60a83 Mon Sep 17 00:00:00 2001 From: Francois Date: Thu, 25 Jul 2024 13:06:26 +0000 Subject: [PATCH] iloc bug --- hypernetx/algorithms/hypergraph_modularity.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hypernetx/algorithms/hypergraph_modularity.py b/hypernetx/algorithms/hypergraph_modularity.py index e91f2db3..36bc4bbd 100644 --- a/hypernetx/algorithms/hypergraph_modularity.py +++ b/hypernetx/algorithms/hypergraph_modularity.py @@ -183,7 +183,7 @@ def modularity(HG, A, wdc=linear): _df = pd.DataFrame(zip(_keys, _vals), columns=["key", "val"]) _df = _df.groupby(by="key").sum() EC = sum( - [wdc(k[1], k[0]) * v[0] for (k, v) in _df.iterrows() if k[0] > k[1] / 2] + [wdc(k[1], k[0]) * v.iloc[0] for (k, v) in _df.iterrows() if k[0] > k[1] / 2] ) ## Degree Tax @@ -402,7 +402,7 @@ def _last_step_weighted(H, A, wdc, delta=0.01, verbose=False): _df = _df.groupby(by="key").sum() ec = sum( [ - wdc(k[1], k[0]) * val[0] + wdc(k[1], k[0]) * val.iloc[0] for (k, val) in _df.iterrows() if k[0] > k[1] / 2 ] @@ -430,7 +430,7 @@ def _last_step_weighted(H, A, wdc, delta=0.01, verbose=False): _df = _df.groupby(by="key").sum() ecp = sum( [ - wdc(k[1], k[0]) * val[0] + wdc(k[1], k[0]) * val.iloc[0] for (k, val) in _df.iterrows() if k[0] > k[1] / 2 ]