Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
how do i create and append to an array? (i cant figure out the scipy page)

Hello,

i got real good help with my last question, thank you. now i have a question about my question...i would like to create an array that stores the difference of 10ma and 50ma for each stock. i can do it with a list but lists dont work for what i want to do with the data. Any help is much appreciated!
Thanks!

1 response

If your list of stocks is of fixed length (or known maximum length), then you could create a numpy ndarray of zeros, for example, and then fill it:

http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.zeros.html
http://stackoverflow.com/questions/568962/how-do-i-create-an-empty-array-matrix-in-numpy