Skip to content

Instantly share code, notes, and snippets.

@ChristopherDaigle
Created June 1, 2020 01:57
Show Gist options
  • Save ChristopherDaigle/f14fa42fbceeb894b642c46988c0f86b to your computer and use it in GitHub Desktop.
Save ChristopherDaigle/f14fa42fbceeb894b642c46988c0f86b to your computer and use it in GitHub Desktop.
from sklearn.preprocessing import MinMaxScaler
scaler = MinMaxScaler(feature_range=(0, 1))
numerical = ['orig_title_len', 'overview_len', 'tagline_len', 'title_len',
'popularity', 'runtime', 'vote_average', 'vote_count']
df_impute_log_minmax = pd.DataFrame(data = df_1_impute_fill).copy()
df_impute_log_minmax[numerical] = scaler.fit_transform(df_1_impute_fill[numerical])
# Preserve final df transformation:
df_impute_transformed = df_impute_log_minmax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment