0

Here is my code:

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.model_selection import train_test_split

fruits = pd.read_table('readonly/fruit_data_with_colors.txt')

from matplotlib import cm

X = fruits[['height', 'width', 'mass', 'color_score']]
y = fruits['fruit_label']
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)

cmap = cm.get_cmap('gnuplot')
scatter = pd.scatter_matrix(X_train, c= y_train, marker = 'o', s=40, hist_kwds={'bins':15}, figsize=(9,9), cmap=cmap)

My education had pandas version '0.19.2' and pd.scatter_matrix works fine. But I got the error message below when I run it on my Jupyter Notebook with pandas '1.4.2.'.

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

How can I make it run on my Jupyter Notebook?

Jay Ji
  • 1
  • 2

1 Answers1

0

I guess it has now changed to pandas.plotting.scatter_matrix


Have a look at the document below.
https://pandas.pydata.org/docs/reference/api/pandas.plotting.scatter_matrix.html

jaemmin
  • 341
  • 1
  • 12
  • I tried it and it returns array object but no plotting. And an error says "Javascript Error: IPython is not defined" – Jay Ji Aug 10 '22 at 15:13
  • I guess it's not a problem of pandas. but of jupyter. Hope the link helps you. https://stackoverflow.com/questions/51922480/javascript-error-ipython-is-not-defined-in-jupyterlab – jaemmin Aug 10 '22 at 23:46