Skip to content

Conversation

mdhaber
Copy link
Contributor

@mdhaber mdhaber commented Jul 11, 2024

Reference issue

gh-21077

What does this implement/fix?

The docstring of find_repeats mentions:

In numpy >= 1.9 numpy.unique provides similar functionality. The main difference is that find_repeats only returns repeated values.

NumPy 1.9 has been available for a while now, and we were not able to find many uses of find_repeats (gh-21077), so we discussed removing the function rather than adding array API support.

Additional information

Needs approval on discuss before merge.

@mdhaber mdhaber added scipy.stats deprecated Items related to behavior that has been deprecated labels Jul 11, 2024
@mdhaber mdhaber changed the title DEP: stats.find_repeats: deprecate function DEP: stats.find_repeats: deprecate function Jul 11, 2024
Copy link
Contributor

@tylerjereddy tylerjereddy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess if you do this you need one more spot patched as below (or with a suppression of the warning, or with replacement by the NumPy equivalent). By the way, what happens for the mstats version of the function if you do this? Does that one get to stay since the mask-related functionality is still unique to SciPy?

--- a/scipy/stats/tests/test_mstats_basic.py
+++ b/scipy/stats/tests/test_mstats_basic.py
@@ -1865,7 +1865,9 @@ class TestCompareWithStats:
         xm = np.ma.array(tmp, mask=mask)
         x_orig, xm_orig = x.copy(), xm.copy()
 
-        r = stats.find_repeats(x)
+        message = "`scipy.stats.find_repeats` is deprecated..."
+        with pytest.deprecated_call(match=message):
+            r = stats.find_repeats(x)

@mdhaber
Copy link
Contributor Author

mdhaber commented Jul 11, 2024

Yes, I'll fix that. Done. Note that the test was basically testing the function against itself before since the stats and mstats versions shared an implementation.
And yes, I think the mstats version can stay for that reason and others.

@lucascolley lucascolley added the needs-release-note a maintainer should add a release note written by a reviewer/author to the wiki label Jul 11, 2024
@lucascolley lucascolley added this to the 1.15.0 milestone Jul 11, 2024
Copy link
Member

@j-bowhay j-bowhay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdhaber I would be happy to review and merge this, it has been a week no complaints from the dev forum

[docs only]

Co-authored-by: Jake Bowhay <60778417+j-bowhay@users.noreply.github.com>
@mdhaber mdhaber marked this pull request as ready for review July 18, 2024 13:40
Copy link
Member

@j-bowhay j-bowhay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mdhaber

@j-bowhay j-bowhay merged commit 7f6379f into scipy:main Jul 18, 2024
33 of 34 checks passed
@j-bowhay j-bowhay removed the needs-release-note a maintainer should add a release note written by a reviewer/author to the wiki label Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecated Items related to behavior that has been deprecated scipy.stats
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants