Dear Olivier,

Thank you very much for your help. It worked fine!


Tetsuro Kikuchi





                                                                                
                                                             
                      Olivier Delalleau                                         
                                                             
                      <sh...@keba.be>                宛先:     Discussion of 
Numerical Python <numpy-discussion@scipy.org>                   
                      送信者:                        cc:                           
                                                          
                      numpy-discussion-bounce        件名:     Re: 
[Numpy-discussion] How to modify an array                                 
                      s...@scipy.org                                            
                                                                
                                                                                
                                                             
                                                                                
                                                             
                      2012/02/27 10:01                                          
                                                             
                      Discussion of Numerical                                   
                                                             
                      Python へ返信してくださ                                           
                                                     
                      い                                                         
                                                            
                                                                                
                                                             
                                                                                
                                                             




This should do what you want:

array_copy = my_array.copy()
array_copy[array_copy == 2] = 0

-=- Olivier

Le 26 février 2012 19:53, <tetsuro_kiku...@jesc.or.jp> a écrit :
Dear sirs,


Please allow me to ask you a beginner's question.

I have an nparray whose shape is (144, 91, 1). The elements of this array
are integer "0", "1" or "2", but I don't know which of the three integers
is assigned to each element.
I would like to make a copy of this array, and then replace only the
elements whose value is "2" into "0". Could you teach how to make such a
modification?


Sincerely yours,

Tetsuro Kikuchi



_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion



_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to