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 Normalizer 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 = Normalizer().fit(X) normalizedX = scaler.transform(X) # summarize transformed data numpy.set_printoptions(precision=2) print(normalizedX[0:10,:]) #All rows now have a maximum length of 1.
[[0.8 0.55 0.22 0.03]
[0.83 0.51 0.24 0.03]
[0.81 0.55 0.22 0.03]
[0.8 0.54 0.26 0.03]
[0.79 0.57 0.22 0.03]
[0.78 0.57 0.25 0.06]
[0.78 0.58 0.24 0.05]
[0.8 0.55 0.24 0.03]
[0.81 0.53 0.26 0.04]
[0.82 0.52 0.25 0.02]]