AttributeError: module 'pandas' has no attribute 'scatter_matrix'


Error: "AttributeError: module 'pandas' has no attribute 'scatter_matrix'"

When you copy paste code from online source, as-usual it always end-up with so many bugs. So today when I was working on Pyspark - Linear regression for boston.csv and using pandas with scatter plot I see the attribute error.

What is Attribute error:

A Python Attribute Error is raised when you try to call an attribute of an object whose type does not support that method

In our case we were executing below code "axs = pd.scatter_matrix(sampled_data, figsize=(1010)) "

so error clearly says scatter_matrix is not available in pandas


A bit of google and we found scatter_matrix is available in pandas.plotting

So correct code is  "axs = pd.plotting.scatter_matrix(sampled_data, figsize=(1010)) "

No comments:
Write comments

Please do not enter spam links

Meet US


More Services