[Numpy-discussion] numpy.append & numpy.where vs list.append and brute iterative for loop

Sturla Molden sturla at molden.no
Thu Jan 27 16:53:40 EST 2011


Den 27.01.2011 22:47, skrev Sturla Molden:
>
> Please observe that appending to a Python list is amortized O(1),
> whereas appending to a numpy array is O(N**2).
>

Sorry, one append to a numpy array is O(N).

But N appends are O(N) for lists and O(N*N) for arrays.

S.M.



More information about the NumPy-Discussion mailing list