Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sklearn.preprocessing import MinMaxScaler
- def process_structured_data(df, train, test):
- """
- Pre-processes the given dataframe by minmaxscaling the continuous features
- (fit-transforming the training data and transforming the test data)
- """
- continuous = ["population_per_hectare", "bicycle_aadf", "motor_vehicle_aadf"]
- cs = MinMaxScaler()
- trainX = cs.fit_transform(train[continuous])
- testX = cs.transform(test[continuous])
- return (trainX, testX)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement