Run ❯
Get your
own Python
server
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
import pandas import scipy import numpy from sklearn.preprocessing import StandardScaler fileurl = 'https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data' names = ['septal_length','sepal_with','petal_length','pedal_width','class'] data = pandas.read_csv(fileurl, names=names) array = data.values # input/output component separation X = array[:,0:4] Y = array[:,4] scaler = StandardScaler().fit(X) standardX = scaler.transform(X) # summarize transformed data numpy.set_printoptions(precision=2) print(standardX[0:20,:]) #The Iris data is transformed to a standard deviation of 1 and a mean of 0.
[[-0.9 1.03 -1.34 -1.31]
[-1.14 -0.12 -1.34 -1.31]
[-1.39 0.34 -1.4 -1.31]
[-1.51 0.11 -1.28 -1.31]
[-1.02 1.26 -1.34 -1.31]
[-0.54 1.96 -1.17 -1.05]
[-1.51 0.8 -1.34 -1.18]
[-1.02 0.8 -1.28 -1.31]
[-1.75 -0.36 -1.34 -1.31]
[-1.14 0.11 -1.28 -1.44]
[-0.54 1.49 -1.28 -1.31]
[-1.26 0.8 -1.23 -1.31]
[-1.26 -0.12 -1.34 -1.44]
[-1.87 0.12 -1.51 -1.44]
[-0.05 2.19 -1.46 -1.31]
[-0.17 3.11 -1.28 -1.05]
[-0.54 1.96 -1.4 -1.05]
[-0.9 1.03 -1.34 -1.18]
[-0.17 1.73 -1.17 -1.18]
[-0.9 1.73 -1.28 -1.18]]