On Thu, Oct 23, 2008 at 5:55 PM, Pierre Yger <[EMAIL PROTECTED]> wrote:
>
> import bisect
> my_list.sort()
> time, ind = zip(*my_list)
> for i in id_list :
> beg = bisect.bisect_left(ind,i)
>end = bisect.bisect_right(ind,i)
>mylist.append(tim[beg:end])
>
I've always found itertools.gr
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Thanks everybody for all your feedback !!!
Ok, so first, I just must have to precise what was my problem and why I
used Numpy. Because I want to extract only some ids in the lists. In
fact, I've a test in my list implementation:
for id, time in my_li
2008/10/23 Charles R Harris <[EMAIL PROTECTED]>:
> In [4]: ind = [i for i,j in spikes]
> In [5]: tim = [j for i,j in spikes]
Just for interest's sake, 'zip' is an interesting function in that it
works both ways around:
In [26]: zip(*zip([1,2,3],[3,4,5]))
Out[26]: [(1, 2, 3), (3, 4, 5)]
So a pers
On Wed, Oct 22, 2008 at 10:21 AM, Pierre Yger <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> This is my first mail to the mailing list, and I would like to know if
> anybody
> has a great idea about the use or not of Numpy and loops in Python.
>
> So here is my problem : I've a large list of tuple (id,
> >> spikes = [(0, 2.3),(1, 5.6),(3, 2.5),(0, 5.2),(3, 10.2),(2, 16.2)]
>
> mysort(spikes)
>
> should return:
>
> [[2.3, 5.2], [5.6], [16.2], [2.5, 10.2]]
>
> Intuitively, the simplest way to do that is to append elements while going
> through all the tuples of the main list (called spikes)
Hi all,
This is my first mail to the mailing list, and I would like to know if anybody
has a great idea about the use or not of Numpy and loops in Python.
So here is my problem : I've a large list of tuple (id, time),
id being integer between [0, ..., N] and time float values.
I want to have a