Open mrocklin opened 8 years ago
In NumPy I do this:
In [1]: import numpy as np In [2]: x = np.arange(9).reshape((3, 3)) In [3]: x Out[3]: array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) In [4]: ind = np.array([True, False, True]) In [5]: x[ind, :] Out[5]: array([[0, 1, 2], [6, 7, 8]]) In [6]: x[:, ind] Out[6]: array([[0, 2], [3, 5], [6, 8]])
In DyND-python I can get partway there
In [7]: from dynd import nd In [8]: x = nd.array(x) In [9]: x Out[9]: nd.array([[0, 1, 2], [3, 4, 5], [6, 7, 8]], type="3 * 3 * int64") In [10]: ind = nd.array(ind) In [11]: nd.take(x, ind) Out[11]: nd.array([[0, 1, 2], [6, 7, 8]], type="var * 3 * int64")
But don't know how to proceed to take along the other dimension.
@izaid any comments here?
In NumPy I do this:
In DyND-python I can get partway there
But don't know how to proceed to take along the other dimension.