Deprecation of `scipy.stats.mstats`

gh-22194 proposed that we turn attention from scipy.stats.mstats toward adding support for missing data to scipy.stats functions. At this point, I think all the functionality we wanted to preserve can be achieved via the usual scipy.stats functions, mostly using MArrays that wrap NumPy, CuPy, or PyTorch arrays (rather than NumPy masked arrays). With SciPy 2.0 making alternative backend support public, I’d propose that we deprecate scipy.stats.mstats functions in SciPy 2.0 and remove them in SciPy 2.2.

To minimize disruption, we will:

  • release a separate mstats package compatible with SciPy 2.0 that reflects scipy.stats.mstats from SciPy 1.18.0
  • add a transition guide with examples of using MArrays and nan_policy=’omit’ to replace the use of NumPy masked arrays and scipy.stats.mstats.
  • emit a deprecation warning when any scipy.stats.mstats function is executed
  • include deprecation admonitions for every scipy.stats.mstats function and in other scipy.stats.mstats documentation in the SciPy 2.0 and 2.1 documentation
  • mention the deprecation in the SciPy 2.0 release notes

Please join the discussion in gh-22194 and consider reviewing the initial implementation PR, gh-26018.

Thanks,
Matt

2 Likes