Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

normalize data python pandas

import pandas as pd
from sklearn import preprocessing

x = df.values #returns a numpy array
min_max_scaler = preprocessing.MinMaxScaler()
x_scaled = min_max_scaler.fit_transform(x)
df = pd.DataFrame(x_scaled)
Comment

normalize data python

from sklearn import preprocessing

data = [[ 1., -1.,  2.],
        [ 2.,  0.,  0.],
        [ 0.,  1., -1.]]
normalize(data)

# produces
array([[ 0.40824829, -0.40824829,  0.81649658],
       [ 1.        ,  0.        ,  0.        ],
       [ 0.        ,  0.70710678, -0.70710678]])
Comment

data normalization python

from sklearn import preprocessing
normalizer = preprocessing.Normalizer().fit(X_train)  
X_train = normalizer.transform(X_train)
X_test = normalizer.transform(X_test)
Comment

PREVIOUS NEXT
Code Example
Python :: numpy create a matrix of certain value 
Python :: how to create a python venv 
Python :: python - removeempy space in a cell 
Python :: create a list of characters python 
Python :: python get system information 
Python :: pandas.core.series.series to dataframe 
Python :: django form widget 
Python :: no migrations to apply django 
Python :: discord.py get profile picture 
Python :: how to fill nan values with mean in pandas 
Python :: ffmpeg python cut video 
Python :: convert video to text python 
Python :: how to save unzipped files in python 
Python :: sklearn cross validation score 
Python :: python unit testing machine learning 
Python :: scrfoll with selenium python 
Python :: get os environment python 
Python :: python sorted lambda 
Python :: remove first 2 rows in pandas 
Python :: python emojis 
Python :: selectfield flask wtf 
Python :: import subdirectory python 
Python :: star pattern in python 
Python :: python smtp email 
Python :: last history of whatsapp message with python 
Python :: python make a new window 
Python :: os.listdir in python 
Python :: python apply function to dictionary values 
Python :: python filter list of strings 
Python :: django rest documentation 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =