Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
std of a list

Hello!

i made a list that keeps the difference in 10ma and 50ma in it. i want to call the standard deviation of that list but i guess you cant calculate std on a list? any ideas of how to calculate the std every morning and call it in my handle_data? Thank you!

4 responses

I suggest converting to a numpy ndarray, http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.asarray.html, and then using numpy/scipy for the numerics. Or just don't put your data in a list in the first place--go straight to numpy (or Pandas, if you prefer).

Thank you, yeah all I know so far is basic stuff, I'll look at numpys and pandas. I'm only at basic level, I just hooked up my second screen to my comouter. Lol thank you very much

Hi Tyler,

Here is my quick example of getting the std of a list every morning using numpy.

Awesome! Thanks a lot!