Skip to content

Commit 9fd0a18

Browse files
authored
Merge pull request #104 from juanfonsecaLS1/fix-errors-on-newer-versions
fix: Numpy sum error Closes #102
2 parents 037151f + adb63f7 commit 9fd0a18

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

superblockify/metrics/measures.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ def calculate_coverage(partitioner, weight):
167167
if partitioner.graph.number_of_edges() == partitioner.sparsified.number_of_edges():
168168
return 0
169169

170-
return 1 - npsum(
170+
return 1 - sum(
171171
d[weight] for u, v, d in partitioner.sparsified.edges(data=True)
172-
) / npsum(d[weight] for u, v, d in partitioner.graph.edges(data=True))
172+
) / sum(d[weight] for u, v, d in partitioner.graph.edges(data=True))
173173

174174

175175
def rel_increase(value_i, value_j):

superblockify/partitioning/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,12 @@ def show_highway_stats(graph):
272272
"Dtype counts (type, count, proportion): \n%s", dtype_counts.to_string()
273273
)
274274
# Warning if 'str' is underrepresented
275-
if dtype_counts.loc[dtype_counts.index == str, "proportion"].values < 0.98:
275+
str_proportion_series = dtype_counts.loc[dtype_counts.index == str, "proportion"]
276+
str_proportion = str_proportion_series.iloc[0] if not str_proportion_series.empty else 0.0
277+
if str_proportion < 0.98:
276278
logger.warning(
277279
"The dtype of the 'highway' attribute is not 'str' in %d%% of the edges.",
278-
(1 - dtype_counts.loc[dtype_counts.index == str, "proportion"]) * 100,
280+
int((1 - str_proportion) * 100),
279281
)
280282

281283

0 commit comments

Comments
 (0)