【发布时间】:2019-02-20 03:54:48
【问题描述】:
我有两个 .csv 文件。
第一:
上校名称:'student_id' 和 'mark'
第二:
上校姓名:'student_id','name','surname'
我想用'student_id'、'name'、'surname' 创建第三个.csv 文件,其中row['mark'] == 'five' 或'four'
good_student=[]
for index, row in first_file.iterrows():
if row['mark'] == 'five':
good_student.append(row['studentId'])
elif row['mark'] == 'four':
good_student.append(row['studentId'])
for index, row in second_file.iterrows():
for i in good_student:
if row['studentId'] == i:
【问题讨论】: