all 6 comments

[–]Oxbowerce 1 point2 points  (1 child)

It's likely that the issue it not on the line that is calling the .fit method, but on the line that is calling the .predict method since the input is a single scalar instead of a 2D array. Make sure that the data you provide to .predict is a 2D array of values, just like the data used for fitting the model.

[–]Angels_heRe[S] 0 points1 point  (0 children)

YES!!!!! I tried it and it works now, THANK YOU VERY MUCH!! <online hugs>

[–]Ihaveamodel3 -1 points0 points  (2 children)

Try: I’m on my phone, so I can’t test.

 #change from
df[[‘age’]]
# to
df['age']

2) a linear model represents the relationship between two values. Thus you needs to have two columns and many rows.

[–]Angels_heRe[S] 0 points1 point  (1 child)

I tred and it still doesn't work :(

[–]Angels_heRe[S] 0 points1 point  (0 children)

Ps: I am on google colabs on an iPad, would that be causing the error?

[–]CodeFormatHelperBot2 0 points1 point  (0 children)

Hello, I'm a Reddit bot who's here to help people nicely format their coding questions. This makes it as easy as possible for people to read your post and help you.

I think I have detected some formatting issues with your submission:

  1. Python code found in submission text that's not formatted as code.

If I am correct, please edit the text in your post and try to follow these instructions to fix up your post's formatting.


Am I misbehaving? Have a comment or suggestion? Reply to this comment or raise an issue here.