MNT fix test following scipy dev change
@@ -178,10 +178,16 @@ def threadpool_info():
threadpool_info.__doc__ = threadpoolctl.threadpool_info.__doc__
-# TODO: Remove when SciPy 1.9 is the minimum supported version
+# TODO: Remove when SciPy 1.11 is the minimum supported version
def _mode(a, axis=0):
if sp_version >= parse_version("1.9.0"):
- return scipy.stats.mode(a, axis=axis, keepdims=True)
+ mode = scipy.stats.mode(a, axis=axis, keepdims=True)
+ if sp_version >= parse_version("1.10.999"):
+ # scipy.stats.mode has changed returned array shape with axis=None
+ # and keepdims=True, see https://github.com/scipy/scipy/pull/17561
+ if axis is None:
+ mode = np.ravel(mode)
+ return mode
return scipy.stats.mode(a, axis=axis)
