[Numpy-discussion] suggestions for Matrix-related changes
Michael Sorich
michael.sorich at gmail.com
Tue Jul 11 19:07:56 CDT 2006
On 7/12/06, JJ <josh8912 at yahoo.com> wrote:
> 2) It would be very convienient to have some simple way to delete selected
> columns of a matrix. For example, in matlab the command is X[:,[3,5,7]]=[] to
> delete the three selected columns. It would be nice if such a command would
> also work with selections, as in X[:,A[0,:]<4] = [], where X and A are matrices.
+1.
In R negative integers are used for this purpose and a copy of the
array is returned. e.g.
> x = 1:10
> x
[1] 1 2 3 4 5 6 7 8 9 10
> x[-1]
[1] 2 3 4 5 6 7 8 9 10
> x[c(-1,-2)]
[1] 3 4 5 6 7 8 9 10
> x[-c(1,2)]
[1] 3 4 5 6 7 8 9 10
I like the current use of negative indices in numpy, but I do find
myself missing the ability to easily make a copy of the array without
certain indices.
Mike
More information about the Numpy-discussion
mailing list