Displaying pair plot in Pandas data frame

后端 未结 5 900
梦如初夏
梦如初夏 2021-02-07 06:19

I am trying to display a pair plot by creating from scatter_matrix in pandas dataframe. This is how the pair plot is created:

# Create dataframe from data in X_t         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-07 06:58

    first of all use pip install mglearn then import the mglearn

    the code will be like this...

    from sklearn.datasets import load_iris
    from sklearn.model_selection import train_test_split
    import pandas as pd
    import mglearn
    import matplotlib.pyplot as plt
    
    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)
    plt.show()
    

提交回复
热议问题