[Numpy-discussion] removing and replacing certain values in arrays
Mon Jul 7 15:25:19 CDT 2008
On Monday 07 July 2008 16:08:36 Tim Michelsen wrote:
> how do I remove all rows (or column) from an array which contain a
> certain value or sting?
You could try a combination of masking the values you want to discard,
followed by ma.compress_rows/cols, provided your array is 2D.
>>> import numpy.ma as ma
>>> x[x==3] = ma.masked
array([[1, 2, 4, 5]])
More information about the Numpy-discussion