简体   繁体   中英

Jupyter Note pandas scatter_matrix

Hi the problem is that the Jupyter note tells me pandas does not have the attribute 'scatter_matrix'.

import pandas as pd
from pandas.plotting import scatter_matrix
iris_dataframe = pd.DataFrame(X_train, columns =iris_dataset.feature_names)
grr=pd.scatter_matrix(iris_dataframe, c=y_train, figsize=(15,15), marker='o',
                  hist_kwds={'bins':20}, s=60, alpha=.8, cmap=mglearn.cm3)

This error shows up because scatter_matrix is an attribute of pandas.plotting and not pandas . See you have pandas and scatter_matrix imported. You can either use:

grr=pd.plotting.scatter_matrix(iris_dataframe,c=y_train,figsize(15,15),marker='o',hist_kwds={'bins':20}, s=60, alpha=.8, cmap=mglearn.cm3)

or

grr=scatter_matrix(iris_dataframe,c=y_train,figsize(15,15),marker='o',hist_kwds={'bins':20}, s=60, alpha=.8, cmap=mglearn.cm3)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM