Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. from sklearn.preprocessing import MinMaxScaler
  2.  
  3. def process_structured_data(df, train, test):
  4. """
  5. Pre-processes the given dataframe by minmaxscaling the continuous features
  6. (fit-transforming the training data and transforming the test data)
  7. """
  8. continuous = ["population_per_hectare", "bicycle_aadf", "motor_vehicle_aadf"]
  9. cs = MinMaxScaler()
  10. trainX = cs.fit_transform(train[continuous])
  11. testX = cs.transform(test[continuous])
  12. return (trainX, testX)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement