Skip to content

Instantly share code, notes, and snippets.

@lylayang
Last active March 15, 2020 07:34
Show Gist options
  • Save lylayang/07313539d5c91b648490a6a0b53ce194 to your computer and use it in GitHub Desktop.
Save lylayang/07313539d5c91b648490a6a0b53ce194 to your computer and use it in GitHub Desktop.
from sklearn.preprocessing import MinMaxScaler
#create numpy.ndarray
df_arr= df1.values
df1.values = df_arr.astype('float32')
df_arr = np.reshape(df_arr, (-1, 1)) #LTSM requires more input features compared to RNN or DNN
scaler = MinMaxScaler(feature_range=(0, 1))#LTSM is senstive to the scale of features
df_arr = scaler.fit_transform(df_arr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment