Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ch.2 Error using corr() #686

Open
rejgrant opened this issue Oct 21, 2023 · 1 comment
Open

Ch.2 Error using corr() #686

rejgrant opened this issue Oct 21, 2023 · 1 comment

Comments

@rejgrant
Copy link

I am getting the following error while using corr_matrix = housing.corr(), I know the method should exclude non-numerical columns, can't understand this error.
" ValueError: could not convert string to float: 'INLAND' "

@khushi-98
Copy link

Try this:-
housing_encoded = pd.get_dummies(housing, columns=['INLAND'], drop_first=True)
corr_matrix = housing_encoded.corr()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants