[Numpy-discussion] How to remove any row or column of a numpy matrix whose sum is 3?
Mon Jun 4 11:56:38 CDT 2012
On Mon, Jun 4, 2012 at 9:38 AM, Robert Kern <email@example.com> wrote:
> # Now use the numpy.delete() function to get the matrix
> # with those rows and columns removed from the original matrix.
> P = np.delete(M, bad_rows, axis=0)
> P = np.delete(P, bad_cols, axis=1)
ah yes, forgot about np.delete -- that is a bit cleaner -- also,
nonzero() rather than argwhere() is also cleaner.
i.e. listen to Robert, not me!
Christopher Barker, Ph.D.
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
More information about the NumPy-Discussion