8000 FIX for len(result) > minlength · scikit-learn/scikit-learn@d6655fa · GitHub
[go: up one dir, main page]

Skip to content

Commit d6655fa

Browse files
committed
FIX for len(result) > minlength
1 parent 04b31e2 commit d6655fa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sklearn/utils/fixes.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,10 @@ def _unique(ar, return_index=False, return_inverse=False):
109109

110110
def _bincount(X, weights=None, minlength=None):
111111
"""Replacing np.bincount in numpy < 1.6 to provide minlength."""
112-
out = np.zeros(minlength, np.int)
113112
result = np.bincount(X, weights)
113+
if len(result) >= minlength:
114+
return result
115+
out = np.zeros(minlength, np.int)
114116
out[:len(result)] = result
115117
return out
116118

0 commit comments

Comments
 (0)
0