Answers for "how to read sklearn dataset to pandas dataframe"

2

scikit learn dataset into pandas dataframe

def answer_one(): 
    import numpy as np
    import pandas as pd
    from sklearn.datasets import load_breast_cancer 
    cancer = load_breast_cancer()     
    data = np.c_[cancer.data, cancer.target]
    columns = np.append(cancer.feature_names, ["target"])
    return pd.DataFrame(data, columns=columns)

answer_one()
Posted by: Guest on August-18-2020

Code answers related to "how to read sklearn dataset to pandas dataframe"

Python Answers by Framework

Browse Popular Code Answers by Language