Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to scale a pandas dataframe

import seaborn as sns
import pandas as pd
import numpy as np
 
data = sns.load_dataset('iris')
print('Original Dataset')
data.head()
 
# Min-Max Normalization
df = data.drop('species', axis=1)
df_norm = (df-df.min())/(df.max()-df.min())
df_norm = pd.concat((df_norm, data.species), 1)
 
print("Scaled Dataset Using Pandas")
df_norm.head()
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #How #scale #pandas #dataframe
ADD COMMENT
Topic
Name
3+3 =