Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (36.8k points)

In jupyter, I am trying to run the pd.scatter_matrix using the below code:

import matplotlib.pyplot as plt

import pandas as pd

from sklearn import datasets

%matplotlib inline

plt.style.use('ggplot')

# Load some data

iris = datasets.load_iris()

iris_df = pd.DataFrame(iris['data'], columns=iris['feature_names'])

iris_df['species'] = iris['target']

pd.scatter_matrix(iris_df, alpha=0.2, figsize=(10, 10))

plt.show()

Error:

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

Then I used the below code in Terminal:

 conda update pandas 

 conda update matplotlib 

I checked my version using the below code:

pd.__version__ to 

I am getting version was 0.24.2

1 Answer

0 votes
by (18.4k points)

This method is under pandas.plotting

from pandas.plotting import scatter_matrix

scatter_matrix(iris_df, alpha=0.2, figsize=(10, 10))

If you are a beginner and want to know more about Data Science the do check out the Data Science course

Browse Categories

...