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 MinMaxScaler fileurl = 'https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data' names = ['sepal_length','sepal_width','petal_length','petal_width','class'] data = pandas.read_csv(fileurl, names=names) array = data.values # input/output component separation X = array[:,0:4] Y = array[:,4] #Dataset is scaled to 0 and 3 scaler = MinMaxScaler(feature_range=(0, 3)) rescaledX = scaler.fit_transform(X) # summarize transformed data numpy.set_printoptions(precision=2) print(rescaledX[0:5,:])
[[0.67 1.87 0.2 0.12]
[0.5 1.25 0.2 0.12]
[0.33 1.5 0.15 0.12]
[0.25 2.38 0.25 0.12]
[0.58 2. 0.2 0.12]]