Back to Community
need help: calculate volatility for every column in data frame

hey guys,
I need your help. I want to calculate the volatility for every date in my data frame.. I only know how to calculate the standard deviation for the whole data frame but I need it for each column(day).
Hope someone can help me here.
see notebook attached and only look for part 1 or 2..i copied it to work with it :) thx

Loading notebook preview...
Notebook previews are currently unavailable.
1 response

Hey Marvin,

By volatility for every date in your data frame, do you just mean standard deviation (just asking since I don't know if there is a financial difference)? To start off, here's what's causing your bugs:

----> 19: You are trying to append standard deviation of "my_price," but "my_price" is empty. I think your intent is to have separate variable names for the price of SPY and the array of prices per day for SPY. So, try renaming the second "my_price" to "my_price_arr"