Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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()
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #scikit #learn #dataset #pandas #dataframe
ADD COMMENT
Topic
Name
6+4 =