On Mon, Feb 27, 2012 at 2:55 PM, Skipper Seabold wrote:
> I am surprised by this (though maybe I shouldn't be?) It's always faster to
> use list comprehension to unpack lists of tuples than np.array/asarray?
>
> [~/]
> [1]: X = [tuple(np.random.randint(10,size=2)) for _ in
> range(100)]
>
> [~/]
>
I am surprised by this (though maybe I shouldn't be?) It's always faster to
use list comprehension to unpack lists of tuples than np.array/asarray?
[~/]
[1]: X = [tuple(np.random.randint(10,size=2)) for _ in
range(100)]
[~/]
[2]: timeit np.array([x1 for _,x1 in
X])
1 loops, best of 3: 26.4 us