Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. import pandas as pd
  2. from sklearn.model_selection import train_test_split
  3.  
  4. from sklearn.preprocessing import StandardScaler
  5.  
  6. data = pd.read_csv('/datasets/travel_insurance.csv')
  7.  
  8. target = data['Claim']
  9. features = data.drop('Claim', axis=1)
  10. features_train, features_valid, target_train, target_valid = train_test_split(
  11. features, target, test_size=0.25, random_state=12345)
  12.  
  13. numeric = ['Duration', 'Net Sales', 'Commision (in value)', 'Age']
  14.  
  15. scaler = StandardScaler()
  16. scaler.fit(features_train[numeric])
  17.  
  18. features_train[numeric] = scaler.transform(features_train[numeric])
  19.  
  20.  
  21. print(features_train.head())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement