-
-
Save letthedataconfess/056d3f12e4a24a43fd455af33b1fb347 to your computer and use it in GitHub Desktop.
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
from sklearn import preprocessing | |
# Create x, where x the 'Fare' column's values as floats | |
x = df[['Fare']].values.astype(float) | |
# Create a minimum and maximum processor object | |
min_max_scaler = preprocessing.MinMaxScaler() | |
# Create an object to transform the data to fit minmax processor | |
x_scaled = min_max_scaler.fit_transform(x) | |
# Run the normalizer on the dataframe | |
df['Fare'] = pd.DataFrame(x_scaled) | |
df.Fare.head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment