Skip to content
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

numpy.take #149

Closed
TuskAW opened this issue Jul 7, 2022 · 3 comments
Closed

numpy.take #149

TuskAW opened this issue Jul 7, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@TuskAW
Copy link

TuskAW commented Jul 7, 2022

I looked through the code looking for the equivalent call for numpy.take. Does that function exist in the library?

Thanks,

James

@dpilger26
Copy link
Owner

dpilger26 commented Jul 8, 2022

You can achieve the same thing using the NdArray access operators.

The equivalent to

np.take(a, indices)

would be

a[indices]

The equivalent to

np.take(a, indices, axis=0)

would be

a[indices, a.cSlice()]

The equivalent to

np.take(a, indices, axis=1)

would be

a[a.rSlice(), indices]

I'll add take() to the next release.

@dpilger26 dpilger26 self-assigned this Jul 8, 2022
@dpilger26 dpilger26 added the enhancement New feature or request label Jul 8, 2022
@dpilger26
Copy link
Owner

Added to Version 2.8.0 release.

@TuskAW
Copy link
Author

TuskAW commented Jul 22, 2022

Thank you!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants