[Numpy-discussion] Excluding index in numpy like negative index in R?

2008-12-10 Thread Bab Tei
Keith Goodman kwgoodman at gmail.com writes: On Tue, Dec 9, 2008 at 12:25 PM, Bab Tei babaktei at yahoo.com wrote: I can exclude a list of items by using negative index in R (R-project) ie myarray[-excludeindex]. As negative indexing in numpy (And python) behave differently ,how can I

[Numpy-discussion] Excluding index in numpy like negative index in R?

2008-12-09 Thread Bab Tei
Hi I can exclude a list of items by using negative index in R (R-project) ie myarray[-excludeindex]. As negative indexing in numpy (And python) behave differently ,how can I exclude a list of item in numpy? Regards, Teimourpour ___

Re: [Numpy-discussion] Excluding index in numpy like negative index in R?

2008-12-09 Thread Joshua Lippai
You can make a mask array in numpy to prune out items from an array that you don't want, denoting indices you want to keep with 1's and those you don't want to keep with 0's. For instance, a = np.array([1,3,45,67,123]) mask = np.array([0,1,1,0,1],dtype=np.bool) anew = a[mask] will set anew equal

Re: [Numpy-discussion] Excluding index in numpy like negative index in R?

2008-12-09 Thread Keith Goodman
On Tue, Dec 9, 2008 at 12:25 PM, Bab Tei [EMAIL PROTECTED] wrote: I can exclude a list of items by using negative index in R (R-project) ie myarray[-excludeindex]. As negative indexing in numpy (And python) behave differently ,how can I exclude a list of item in numpy? Here's a painful way