[Numpy-discussion] Double-ended queues

2012-09-25 Thread William Furnass
Hi all, I want to be able to within a loop a) apply a mathematical operation to all elements in a vector (can be done atomically) then b) pop zero or more elements from one end of the vector and c) push zero or more elements on to the other end. So far I've used a collections.deque to store my ve

Re: [Numpy-discussion] Indexing 2d arrays by column using an integer array

2012-02-13 Thread William Furnass
Thank you, that does the trick. Regards, Will On 13 February 2012 19:39, Travis Oliphant wrote: > I think the following is what you want: > > neighborhoods[range(9),perf[neighbourhoods].argmax(axis=1)] > > -Travis > > > On Feb 13, 2012, at 1:26 PM, William Furn

[Numpy-discussion] Indexing 2d arrays by column using an integer array

2012-02-13 Thread William Furnass
Hi, Apologies if the following is a trivial question. I wish to index the columns of the following 2D array In [78]: neighbourhoods Out[78]: array([[8, 0, 1], [0, 1, 2], [1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7], [6, 7, 8], [7,