[SciPy-user] appending rows to an array

Stephen Walton stephen.walton at csun.edu
Wed Oct 19 11:14:14 CDT 2005


Ramon Crehuet wrote:

>Dear all,
>    I need to append rows to an array (many times).
>
I know someone will correct me if I'm wrong here, but one of the things 
which makes arrays fast is that they have a fixed size.  A MATLAB trick 
may help you:

A = zeros((max_number_rows_I_need,50));
# do your thing with A, keeping track of how many rows you use.  Call 
that nrows.  Then
A = A[:nrows,:]




More information about the SciPy-user mailing list