convert the sklearn dataset cancer to a dataframe

Solutions on MaxInterview for convert the sklearn dataset cancer to a dataframe by the best coders in the world

showing results for - "convert the sklearn dataset cancer to a dataframe "
Ashley
08 Aug 2020
1import numpy as np
2import pandas as pd
3from sklearn.datasets import load_breast_cancer
4
5cancer = load_breast_cancer()
6print cancer.keys()
7
8data = pd.DataFrame(cancer.data, columns=[cancer.feature_names])
9data['Target'] = pd.Series(data=cancer.target, index=data.index)
10
11print data.keys()
12print data.shape
13