Hi,
As taken from https://blog.quantinsti.com/trading-using-machine-learning-python/, i had “ValueError: Cannot set a DataFrame with multiple columns to the single column Error_95” when running this code df[‘P_C_%i’%t]=0. Is there anything wrong with this code?
Hi,
It is difficult to recreate the error and help with the code without the previous code which you have written. Can you share the file on a publicly accesible google drive and share the link or send it to quantra@quantinsti.com to take a look further.
Meanwhile, it seems that the code is trying to assign a DataFrame with multiple columns to a single column in another DataFrame.
You could try to make it return a 1-D array by using the code as
df[‘P_C_%i’%t] = reg1.predict(X[:]).flatten()
Hope this helps.