[BUG] [Chapter2] ValueError when calculating the correlations in corr_matrix = housing.corr()
Open
- Dominant language
- Jupyter Notebook
- Stars
- 30k
- Forks
- 13.1k
- PR merge metrics
- No merged PRs in 30d
Description
The following ValueError occurs when calling
`corr_matrix = housing.corr()`
**ValueError: could not convert string to float: 'INLAND'**
Obviously the DataFrame gets confused by the values in "ocean_proximity"
For me the solution was to change the 2 lines were the correlations are calculated to:
`corr_matrix = housing.corr(numeric_only=True)`
According to:
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.corr.html
The default value of numeric_only for DataFrame.corr() was changed to False effective as of pandas 2.0.0
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.