8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 71a647f commit d60af3dCopy full SHA for d60af3d
sklearn/utils/fixes.py
@@ -178,10 +178,16 @@ def threadpool_info():
178
threadpool_info.__doc__ = threadpoolctl.threadpool_info.__doc__
179
180
181
-# TODO: Remove when SciPy 1.9 is the minimum supported version
+# TODO: Remove when SciPy 1.11 is the minimum supported version
182
def _mode(a, axis=0):
183
if sp_version >= parse_version("1.9.0"):
184
- return scipy.stats.mode(a, axis=axis, keepdims=True)
+ mode = scipy.stats.mode(a, axis=axis, keepdims=True)
185
+ if sp_version >= parse_version("1.10.999"):
186
+ # scipy.stats.mode has changed returned array shape with axis=None
187
+ # and keepdims=True, see https://github.com/scipy/scipy/pull/17561
188
+ if axis is None:
189
+ mode = np.ravel(mode)
190
+ return mode
191
return scipy.stats.mode(a, axis=axis)
192
193
0 commit comments