關於迴圈使用於app_train(list)的語法問題
2020/03/29 06:03 下午
機器學習共學討論版
江柏勳
觀看數:3
回答數:2
收藏數:0
for col in app_train:
if app_train[col].dtype == 'object':
# 如果只有兩種值的類別型欄位
if len(list(app_train[col].unique())) <= 2:
# 就做 Label Encoder, 以加入相關係數檢查
app_train[col] = le.fit_transform(app_train[col])
問一下就是,為何for這一行可以取app_train(它應是個dataframe而非list阿)