Repository navigation
Closes 4831, standardizes axis checking for cases where axis can only be an integer - #4834
Merged
Merged
Conversation
drculhane
force-pushed
the
Alternate-4800
branch
2 times, most recently
from
August 29, 2025 13:44
a63a7ce to
7ada2dd
Compare
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Aug 29, 2025
drculhane
force-pushed
the
Alternate-4800
branch
from
September 2, 2025 12:42
7ada2dd to
3bc41ed
Compare
ajpotts
approved these changes
Sep 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4831, which is a subset of #4800
This covers the cases where the axis parameter can only be an integer. This only applies to array_api and numpy functions, and not the pandas functions (where axis can be 0 or 1, "index" or "columns").
It doesn't cover the cases where the axis parameter can be a tuple.
Quick summary:
There is now a function in numpy/util.py called _integer_axis_validation. It returns a bool and an int. If the bool is false, the given axis wasn't valid, and in (I think) every case, an IndexError is raised.
There are several functions in array_api that just pass their parameters to arkouda/numpy functions with the same name. In those cases, I don't bother to check at the array_api level.
Note that array_api's vecdot accepted an axis parameter, but didn't use it. I changed that so that it passes the axis argument to the numpy function. Also note that vecdot handles the axis validation differently than other functions, so it doesn't use the standard validation.
Also also note that expand_dims and stack are unique in that they check the validity against a rank 1 greater than the given input.