[SciPy-user] Array manipulation

Nils Wagner nwagner at iam.uni-stuttgart.de
Wed Feb 14 03:02:34 EST 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