批量修改列值

tmp_file = tmp_file.rename(columns={'类别': 'Category'})

train_resample['Category'] = train_resample.Category.map(lambda x: 1 if x =='水杯' else 0)

原文地址:https://www.cnblogs.com/wangshuyi/p/14299357.html