[SciPy-user] Array manipulation

Nils Wagner nwagner@iam.uni-stuttgart...
Wed Feb 14 02:02:34 CST 2007


Hi,

I would like to remove the i-th column and row from a two-dimensional
array A. The remaining array
should be kept and stored in B

A = random.rand(n,n)

This task is very easy if i is the first or last row/column. In that
case one can use

B = A[1:,1:]

or

B=A[:-1,:-1]

But, what is the best way to get B  if  0 < i < n-1 ?

Nils

 


More information about the SciPy-user mailing list