Skip to content

Commit 05fc4e7

Browse files
committed
util.countnans: Don't treat single-row sparse matrices as 1-d
1 parent 9e35194 commit 05fc4e7

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

Orange/statistics/util.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,7 @@ def countnans(x, weights=None, axis=None, dtype=None, keepdims=False):
212212
arr = arr.tocsr()
213213
counts = _count_nans_per_row_sparse(arr, weights, dtype=dtype)
214214

215-
# We want a scalar value if `axis=None` or if the sparse matrix is
216-
# actually a vector (e.g. [[1 2 3]]), but has `ndim=2` due to scipy
217-
# implementation
218-
if axis is None or x.shape[0] == 1:
215+
if axis is None:
219216
counts = counts.sum(dtype=dtype)
220217

221218
return counts

0 commit comments

Comments
 (0)