rust-ndarray / ndarray

ndarray: an N-dimensional array with array views, multidimensional slicing, and efficient operations

Home Page:https://docs.rs/ndarray/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implement take

WillAyd opened this issue · comments

Not sure if there is an equivalent way to sort an array by another, but numpy has take as a convenience function:

https://numpy.org/doc/stable/reference/generated/numpy.take.html

While ndarray has slice and to_slice methods, I don't think these are round-trippable the same way that take would be, since to_slice returns a primitive slice whereas slice looks for a SliceArg argument

I think what you are searching is select, no?

Ah thanks - yea I think that works. Appreciate the guidance