I am trying to use my linearRegression() model to make a prediction based on a new x value. TThe x value is within the ranges of my regression model. My code is as follows:
x=df[['A']]
y=df['B']
m = LinearRegression()
m.fit(x,y)
# Test new X
new_x=pd.DataFrame([0.4])
print(m.predict(new_x))
[-28.43482247] UserWarning: X does not have valid feature names, but LinearRegression was fitted with feature names
warnings.warn(
With the error above. The issue is that:
I'm not sure what the warning is telling me.
The value given to me is not right, because the new_x value i entered was on the regression line (I outputted this on the graph). And my graph is also x>=0, y>=0 . Here is a picture of my scatter plot:

I have just under a million records as well.
Edit: Solution to 2 is because I was interpreting the number wrong. It should actually be "0.4e7" which give me the expected answer.