-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: stats.kurtosistest: add array API support #20715
Conversation
@@ -1805,6 +1805,9 @@ def kurtosistest(a, axis=0, nan_policy='propagate', alternative='two-sided'): | |||
hypothesis [4]_. | |||
|
|||
""" | |||
xp = array_namespace(a) | |||
a, axis = _chk_asarray(a, axis, xp=xp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For NumPy, _axis_nan_policy
decorator takes care of raveling for axis=None
. It doesn't right now for array API, so bring back _chk_asarray
.
x = xp.arange(30.) | ||
x[29] = NaN | ||
with np.errstate(all='ignore'): | ||
res = stats.kurtosistest(x) | ||
xp_assert_equal(res.statistic, NaN) | ||
xp_assert_equal(res.pvalue, NaN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brought this up from below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM straightforward diff 👍
Reference issue
Toward gh-20544
What does this implement/fix?
Adds array API support to
scipy.stats.kurtosistest
.Additional information
Again just blindly converting the relevant parts of the mega-test to array API. Will split it up into separate tests as appropriate after converting
normaltest
.