8000 MNT fix test following scipy dev change (#25393) · scikit-learn/scikit-learn@d60af3d · GitHub
[go: up one dir, main page]

Skip to content

Commit d60af3d

Browse files
lestevejjerphan
andauthored
MNT fix test following scipy dev change (#25393)
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
1 parent 71a647f commit d60af3d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

sklearn/utils/fixes.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,16 @@ def threadpool_info():
178178
threadpool_info.__doc__ = threadpoolctl.threadpool_info.__doc__
179179

180180

181-
# TODO: Remove when SciPy 1.9 is the minimum supported version
181+
# TODO: Remove when SciPy 1.11 is the minimum supported version
182182
def _mode(a, axis=0):
183183
if sp_version >= parse_version("1.9.0"):
184-
return scipy.stats.mode(a, axis=axis, keepdims=True)
184+
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
185191
return scipy.stats.mode(a, axis=axis)
186192

187193

0 commit comments

Comments
 (0)
0