[Numpy-discussion] list to array is slow
Thu Jul 22 16:37:05 CDT 2010
On Thu, Jul 22, 2010 at 5:09 PM, marco cammarata <email@example.com> wrote:
> any idea why the simple code below is so slow ?
> import numpy as n
> from time import time as t
> dims = (640,480)
> m = n.random.random( dims )
> for i in range(200):
> print t()-t0
> To convert the list into an array takes about 5 sec ...
There was a recent thread that covers similar ground. "Stacking
arrays along new dimension in front"
I think the fastest way was to do
b = n.concatenate(a_[None] for a_ in l)
but I could be mistaken, and there should probably be a more general
solution to this problem.
More information about the NumPy-Discussion