on-internet
← Community

How do I standardize my data so that the mean is 0?

Stack Overflow ·

I'm trying to standardize a dataset in Python as part of principal component analysis. I've managed to do the following so far: cancer_data = pd.read_csv('https://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/breast-cancer-wisconsin.data', header=None) cancer_data.columns = ['Sample code', 'Clump Thickness', 'Uniformity of Cell Size', 'Uniformity of Cell Shape', 'Marginal Adhesion', 'Single Epithelial Cell Size', 'Bare Nuclei', 'Bland Chromatin', 'Normal Nucleoli', 'Mitoses','Class'] cancer_data = cancer_data.replace('?', np.NaN) cancer_data = cancer_data.fillna(can

Comments

Sign in or sign up to comment and upvote.

No comments yet.