I looked at Alex Muci's Adaptive Volitily position sizing algo and wanted to see if I could capture R Squared calcuations in a dataframe, for a 21 day lookback period for whatever symbols I might have along with whatever else data I may want to capture in a dataframe.

I  used: 

rsq = np.apply_along_axis(self.rsquared, 1, arr, self.x)

I want to be sure I understand what np.apply_along_axis its doing, rsquared is the fuction that  takes two equal lenth series as parameters, I found some notes on the internet that indicate "1" should tell rsquared to look at each row of my array 'arr' which contains a series of prices, depending on the number of symbols with 21 price points, and self.x contains a list of numbers 0-20 value. It seems to itterating over the arr and producing a new list with the R squared values. I am not sure I understand what "1" is doing. I guess it has to be working if its giving a result and not throwing an error. I just do not feel like I fully understand how np.apply_along_axis is working with the '1' parameter.

Also is there a more efficent way to get thes calculated values into an exsiting dataframe.