Skip to content

Commit 0f69a37

Browse files
committed
bottlechest.stats: return zeros for empty tables
1 parent f18f6a6 commit 0f69a37

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Orange/statistics/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def stats(X, weights=None, compute_variance=False):
165165
is_numeric = np.issubdtype(X.dtype, np.number)
166166
is_sparse = issparse(X)
167167

168-
if is_numeric and not is_sparse:
168+
if X.size and is_numeric and not is_sparse:
169169
nans = np.isnan(X).sum(axis=0)
170170
return np.column_stack((
171171
np.nanmin(X, axis=0),
@@ -188,7 +188,7 @@ def stats(X, weights=None, compute_variance=False):
188188
X.shape[1] - non_zero,
189189
non_zero))
190190
else:
191-
nans = ~X.astype(bool).sum(axis=0)
191+
nans = ~X.astype(bool).sum(axis=0) if X.size else np.zeros(X.shape[1])
192192
return np.column_stack((
193193
np.tile(np.inf, X.shape[1]),
194194
np.tile(-np.inf, X.shape[1]),

0 commit comments

Comments
 (0)