help regarding extracting a smaller list from larger one

neeru K neuroniru at gmail.com
Thu Sep 15 14:55:08 EDT 2011


Dear Gary,
thank you for the reply.
I will be more specific and take the same example that you have given and
tell you what is my problem -
array([0.0, 1.3, 2.45, 3.87, 4.54, 5.11, 6.90, 7.78, 8.23, 9.01])
from this array I want to a sub-list with lower and upper indexes that are
not present in the above array for example - sub-list[3, 8]
Is there a function for this?
thank you
niranjan


On Thu, Sep 15, 2011 at 10:54 PM, Gary Herron <gherron at digipen.edu> wrote:

> On 09/15/2011 09:40 AM, neeru K wrote:
>
>> Dear Python Users,
>> I am trying to write a code for visualization (raster plots and peri-event
>> time histogram) of time series electrophysiological data using numpy, scipy
>> and matlplotlib in python. I am importing the data into list using loadtext
>> command.
>> I was curious if anyone is aware of a function in numpy that can *extract
>> a smaller list containing numbers from a larger list* given the upper and
>> lower limit of the values between which the smaller list lies.
>> Thank you in advance.
>> Sincerely,
>> niranjan
>>
>> --
>> Niranjan Kambi
>> Senior Research Fellow,
>> Neeraj Lab,
>> National Brain Research Centre,
>> Manesar, Gurgaon-122050
>> Haryana, INDIA
>> Ph:+919818654846
>> website:- http://www.nbrc.ac.in/faculty/**neeraj/Lab_webpage/Niranjan_**
>> Kambi.html<http://www.nbrc.ac.in/faculty/neeraj/Lab_webpage/Niranjan_Kambi.html>
>> email:- neuro.niru at nbrc.res.in <mailto:neuro.niru at nbrc.res.in**>,
>> neuroniru at gmail.com <mailto:neuroniru at gmail.com>
>>
>>  Do mean to extract a sub-list from a list based on lower and upper
> indexes into the list?  Python has a standard notation for indicating
> sub-lists, and numpy implements them:
>
> >>> a = numpy.array(range(10))
> >>> a
> array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
> >>> a[3:6]
> array([3, 4, 5])
>
> If you mean something else, please be more specific, and we'll try again.
>
> Gary Herron
>
>
> --
> Gary Herron, PhD.
> Department of Computer Science
> DigiPen Institute of Technology
> (425) 895-4418
>
> --
> http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110916/33f4e7b7/attachment-0001.html>


More information about the Python-list mailing list