With reference to the below screen, I received the error:

ValueError: Input contains NaN, infinity or a value too large for dtype('float64').

For reading purposes, i'm appending screen shot. Please advise where I have gone wrong. Thanks for your assistance.

My Code:

enter image description here

enter image description here enter image description here

  • 2
    $\begingroup$ It is often more helpful to post your code as markdown as opposed to as pictures. That way people can reproduce it to help solve your problem. $\endgroup$
    – Ethan
    May 30, 2019 at 18:21

1 Answer 1


You have missing values in your DF (NaN) means no observations. You need to skip these values since linear regression cannot handle them. Looks like conversion of sqm failed. Check what the format is and try to get int or float from sqm column to avoid NaN.

If you want to skip NaNs read the docs: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.dropna.html


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.