我正在尝试从df5到df7分配正确的FinalZone。你知道吗
东风7:
OrigZone DestZone FinalZone
5 6 (output should be 9)
8 5 (output should be 2)
df5(最终区域查找表):
Zip3 1 2 3 4 5 6
5 7 2 3 5 8 9
6 3 1 5 8 8 8
7 3 3 8 8 9 1
8 5 5 6 6 2 2
def zone_assign(row):
return df5.iloc[df5.loc[df5['ZIP3']==row['OrigZone']].index,row['DestZone']]
df7.apply(zone_assign, axis=1)
当我运行这个程序时,我得到了一个打印出来的df5,里面有一堆NaN
。我太迷路了。你知道吗
这是一种方法,假设您的
df5
列是整数。你知道吗我想你需要这里
相关问题 更多 >
编程相关推荐