我有两个数据帧。一个数据帧包含组件ID及其性能值。另一个数据框仅包含组件ID,现在我需要将这些数据的性能值从另一个数据帧复制到与此匹配的组件ID。两个数据框没有相同的行数,第二个数据框具有重复的组件ID,因为测量是在不同的日期进行的,因此所有行都是重要且必需的。注意,组件ID不是索引值,它只是列名。以下是两个数据框的开头:
COMPONENT_ID PSRO CRP0_VDDN binned PSRO_SPEED
5 11S02CY381YH1934531232 8.299 1.200 (8.15, 8.4] low_speed
15 11S02CY381YH1934592709 8.332 1.144 (8.15, 8.4] low_speed
26 11S02CY382YH1934663150 8.298 1.198 (8.15, 8.4] low_speed
27 11S02CY382YH1934664062 8.491 1.155 (8.4, 8.65] very_low_speed
35 11S02CY382YH1934687582 8.143 1.118 (7.9, 8.15] medium_speed
另一个是
CORNER COMPONENT_ID LANE PLUGPOSITION TEST_DATE EYE_HEIGHT \
0 FF_SCM1 11S02AA435YH1934064264 11 PB0 2019-01-23 319.8
1 FF_SCM1 11S02AA435YH1934064264 12 PB0 2019-01-23 327.6
2 FF_SCM1 11S02AA435YH1934064264 13 PB0 2019-01-23 335.4
3 FF_SCM1 11S02AA435YH1934064264 7 PB0 2019-01-23 327.6
4 FF_SCM1 11S02AA435YH1934064264 14 PB0 2019-01-23 280.8
EYE_WIDTH EYE_HEIGHT_AVG EYE_WIDTH_AVG EYE_WIDTH_MAX ... \
0 66.3 338.52 57.24875 74.1 ...
1 58.5 338.52 57.24875 74.1 ...
2 70.2 338.52 57.24875 74.1 ...
3 66.3 338.52 57.24875 74.1 ...
4 58.5 338.52 57.24875 74.1 ...
FINISH_TIMESTAMP \
0 2019-01-23 14:03:00.000000
1 2019-01-23 14:03:00.000000
2 2019-01-23 14:03:00.000000
3 2019-01-23 14:03:00.000000
4 2019-01-23 14:03:00.000000
PNP_FILE \
0 DMIW26A484BXRTL~2019-01-23-19-03~POK~3906M04.z...
1 DMIW26A484BXRTL~2019-01-23-19-03~POK~3906M04.z...
2 DMIW26A484BXRTL~2019-01-23-19-03~POK~3906M04.z...
3 DMIW26A484BXRTL~2019-01-23-19-03~POK~3906M04.z...
4 DMIW26A484BXRTL~2019-01-23-19-03~POK~3906M04.z...
HOME_DIRECTORY Etch_length1 \
0 http://ausgsa.ibm.com/projects/m/moosecollecti... 221.693539
1 http://ausgsa.ibm.com/projects/m/moosecollecti... 231.528312
2 http://ausgsa.ibm.com/projects/m/moosecollecti... 233.927511
3 http://ausgsa.ibm.com/projects/m/moosecollecti... 233.625896
4 http://ausgsa.ibm.com/projects/m/moosecollecti... 218.690478
我尝试过
df_new['PSRO']=''
df_new['PSRO_SPEED']=''
df_new['CRP0_VDDN']=''
for j in range(len(df12)):
for i in range(len(df_new)):
if df_new.iloc[i]['COMPONENT_ID']==df12.iloc[j]['COMPONENT_ID']:
df_new.iloc[i]['PSRO']=df12.iloc[j]['PSRO']
df_new.iloc[i]['PSRO_SPEED']=df12.iloc[j]['PSRO_SPEED']
df_new.iloc[i]['CRP0_VDDN']=df12.iloc[j]['CRP0_VDDN']
else:
pass
但这给了我不必要的结果。 df_new数据帧在PSRO,PSRO_SPEED和CRP0_VDDN列中有许多空行。怎么了有没有更好的方法来复制值。