[Numpy-discussion] Trimming the np arrays

2010-06-16 Thread Vishal Rana
Hi, I have a list of np arrays from which I create a np record array, but they all of of different length! How can I trim them all in place (for example I want to get last 10 elements of each)? Thanks Vishal Rana ___ NumPy-Discussion mailing list

Re: [Numpy-discussion] Trimming the np arrays

2010-06-16 Thread Robert Kern
On Wed, Jun 16, 2010 at 12:15, Vishal Rana ranavis...@gmail.com wrote: Hi, I have a list of np arrays from which I create a np record array, but they all of of different length! How can I trim them all in place (for example I want to get last 10 elements of each)? x = x[-10:] -- Robert

Re: [Numpy-discussion] Trimming the np arrays

2010-06-16 Thread Vishal Rana
Robert, Do I have to repeat it for each element in the list or is there a way I can iterate the list and do it? Thanks Vishal Rana On Wed, Jun 16, 2010 at 10:23 AM, Robert Kern robert.k...@gmail.com wrote: On Wed, Jun 16, 2010 at 12:15, Vishal Rana ranavis...@gmail.com wrote: Hi, I have

Re: [Numpy-discussion] Trimming the np arrays

2010-06-16 Thread Robert Kern
On Wed, Jun 16, 2010 at 12:30, Vishal Rana ranavis...@gmail.com wrote: Robert, Do I have to repeat it for each element in the list or is there a way I can iterate the list and do it? new_list = [x[-10:] for x in old_list] -- Robert Kern I have come to believe that the whole world is an

Re: [Numpy-discussion] Trimming the np arrays

2010-06-16 Thread Vishal Rana
It helped, Thanks On Wed, Jun 16, 2010 at 10:39 AM, Robert Kern robert.k...@gmail.com wrote: On Wed, Jun 16, 2010 at 12:30, Vishal Rana ranavis...@gmail.com wrote: Robert, Do I have to repeat it for each element in the list or is there a way I can iterate the list and do it? new_list