I am learning about the basics of pandas and scikit-learn and I came up with a doubt while doing an exercise. It gives me an error. The code should return a (569, 31) DataFrame, but it gives me the following errors:
ValueError: Wrong number of items passed 30, placement implies 31
ValueError: Shape of passed values is (569, 30), indices imply (569, 31)
The piece of code I have is the following:
data = pd.DataFrame(cancer.data, columns= np.append(cancer['feature_names'], ['target']))
print(data.describe())
The cancer.data has 30 columns and I want to append the ['target'] column, so I can convert the cancer dataset to a dataframe with 31 columns instead of 30.