我已经完成了一些代码来进行模型选择,但是这个错误我不理解,并且无法解决,请帮忙
float() argument must be a string or a number, not 'Timestamp'
更改功能
df_new = pd.get_dummies(df, columns=['CARRIER_IATA', 'FLIGHT_NUMBER'
,'AIRCRAFT_REGISTER_CODE','AIRCRAFT_TYPE','AIRCRAFT_SEATS','ORIGIN',
'DESTINATION','TOT_PAX'
])
names =[col for col in df_new.columns if col not in ['AIRPORT_CODE', 'FLIGHT_CATEGOR_CODE','DATE_SCHEDULED',
'TIME_SCHEDULED','DATE_ACTUAL', 'TIME_ACTUAL']]
X = df_new[names]
y = np.where(df['delay']>10, 1, 0) # classification
y = df['delay'] # regression
from sklearn import model_selection, metrics, preprocessing
X_train, X_test, y_train, y_test = model_selection.train_test_split(X, y, test_size=0.33, random_state=1337)
scaler = preprocessing.MinMaxScaler()
scaler.fit_transform(X_train) ## the error pops up here