Hi,
I'm a newbie to Python. I have programmed in R and am struggling a little when trying to follow along with some of the code written and shared on these forums.
I am working through the (Machine Learning on Quantopian code and am stuck because I cannot understand what these functions are doing...
results_wo_returns = results.copy()
returns = results_wo_returns.pop('Returns')
Y = returns.unstack().values
X = results_wo_returns.to_panel()
X = X.swapaxes(2, 0).swapaxes(0, 1).values # (factors, time, stocks) -> (time, stocks, factors)
For copy, I was able to lookup via np.copy? though I am not sure if this is correct given its being run on results which is a pandas dataframe. For the other elements, I cannot find these definitions.
Another thing I don't understand is where Returns is suddenly dropped in results_wo_returns
I appreciate this is a pretty basic question, but I'm struggling to progress without understanding this, and am not even sure what to google.
Much appreciated,
J