# set the targets: normal=0, tumor=1
y_normal = np.zeros(6485)
y_tumor = np.ones(1348)
combined_targets = np.concatenate([y_normal,y_tumor],axis=0)
combined_targets.shape
combined_targets = pd.DataFrame(combined_targets)
combined_targets.columns = ["target"]
combined_targets.value_counts()
final_train_df = combined_df
final_train_df["target"]= combined_targets
final_train_df['target'].value_counts()
如果我直接赋值,那么值不会改变
final_train_df['target'] = np.concatenate([y_normal,y_tumor],axis=0)
由 numpy 创建的列中的值然后转换为数据帧,被强制为零。即使添加为 np.array,这些值也会被强制为零。我在 google colab 工作,之前没有遇到过这个问题