May-26-2018, 05:35 AM
I have a pandas data frame of six columns, I would like to iteratively compute the variance along each column. Since I am a newbie, I don't really understand the niceties of the language and common usage patterns. What is the common Python idiom for achieving the following?
vars = [] for i in range(1, 100000): v = (data.iloc[range(0, i+1)].var()).values if len(vars) == 0: vars = v else: vars = np.vstack((vars, v))Also, when I run this code, it takes a long time to execute. Can anyone suggest how to improve the running time?