I am trying to use a linear regression on a group by pandas python dataframe:
This is the dataframe df:
group date value
A 01-02-201
As a newbie I cannot comment so I will write it as a new answer. To solve an error:
Runtime Error: ValueError : Expected 2D array, got scalar array instead
you need to reshape delta value in line:
return np.squeeze(LinearRegression().fit(X, y).predict(np.array(delta).reshape(1, -1)))
Credit stays for you piRSquared