[Numpy-discussion] Re place array values

jonasr jonas.ruebsam at web.de
Wed Mar 14 19:35:47 EDT 2012


Hello, 

my problem is that i want to remove some small numbers of an 2d array,
for example if i want to sort out all numbers smaller then 1 of an array i
get

x=[[0,1,2],[3,4,5][6,7,8]]

c=x>=1

In [213]: c
Out[213]: 
array([[False,  True,  True],
       [ True,  True,  True],
       [ True,  True,  True]], dtype=bool)

In [214]: x[c]
Out[214]: array([1, 2, 3, 4, 5, 6, 7, 8])

the problem ist that i now have a 1d array, is there any possibility to
keep the 2d structure ? 

greets jonas
-- 
View this message in context: http://old.nabble.com/Replace-array-values-tp33506446p33506446.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.




More information about the NumPy-Discussion mailing list