Last active
November 20, 2020 02:50
-
-
Save isaacarroyov/8c0059d2bf7a38fb68a391acf091e62a to your computer and use it in GitHub Desktop.
relevant code for the preprocessing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#select the relevant variables | |
variables = np.array( [ 'HOMICIDES', 'CAR_THEFT', | |
'EXTORTION', 'STREET_TRANSPORT_THEFT' ] ) | |
#Here we standardize a dataset along any axis. | |
#Center to the mean and component wise scale to unit variance. | |
from sklearn import preprocessing | |
df_standardized = preprocessing.scale( df[variables] ) | |
df_standardized = pd.DataFrame( df_standardized ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment