In the older version of pandas API, the boolean parameter "numeric_only" in .mean() as well as .corr() methods were "True" by default. However, since version 2.0.0, the default value of "numeric_only" is now "False".
Due to this update in the documentation, select only valid columns or specify the value of numeric_only to True to get rid of the error.
using .corr(numeric_only=True) should solve the issue.
============================================================
Related Course on EdX:
https://www.edx.org/learn/data-science/massachusetts-institute-of-technology-understanding-the-world-through-data
Link to documentation page for pandas.DataFrame.mean:
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.mean.html
Link to documentation page for pandas.DataFrame.corr:
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.corr.html
Download
0 formats
No download links available.
How to fix error when executing pandas .corr() function or .mean() function with .groupby() function | NatokHD