執行出現:
DataConversionWarning: Data with input dtype int64 was converted to float64 by MinMaxScaler.
warnings.warn(msg, _DataConversionWarning)
錯誤訊息
df轉入的資料全是整數,在轉normalize時會轉成float,
可以在轉入資料後,再轉為float
df = = pd.read_csv("test.csv")
msk = np.random.rand(len(df)) < 0.8
x_train = df[msk][features].values
y_train_label=df[msk]["letter"].values
x_test = df[~msk][features].values
y_test_label = df[~msk]["letter"].values
可在x_tran轉入的指令更改為float
msk = np.random.rand(len(df)) < 0.8
x_train = df[msk][features].values.astype(float)
y_train_label=df[msk]['letter'].values
x_test = df[~msk][features].values.astype(float)
y_test_label = df[~msk]['letter'].values