Question: import pandas as pd from sklearn import preprocessing hmeq = pd.read_csv('hmeq_small.csv') # Standardize the data standardized = preprocessing.scale(hmeq) # Output the standardized data as a
import pandas as pd
from sklearn import preprocessing
hmeq = pd.read_csv('hmeq_small.csv')
# Standardize the data
standardized = preprocessing.scale(hmeq)
# Output the standardized data as a data frame with column names
hmeqStand = pd.DataFrame(standardized, columns=hmeq.columns)
# Normalize the data
hmeqNorm = pd.DataFrame(preprocessing.normalize(hmeq), columns=hmeq.columns)
# Output the normalized data as a data frame with column names
hmeqNorm = pd.DataFrame(normalized, columns=hmeq.columns)
# Print the means and standard deviations of hmeqStand and hmeqNorm
print("The means of hmeqStand are ", hmeqStand.mean())
print("The standard deviations of hmeqStand are ", hmeqStand.std())
print("The means of hmeqNorm are ", hmeqNorm.mean())
print("The standard deviations of hmeqNorm are ", hmeqNorm.std())
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
