我正在用python编写一个脚本,该脚本使两个表彼此相对。如果满足条件,则脚本将对从属表进行更新。
到目前为止我的python代码:
def updatedata():
for y in range(updatetable.shape[0]):
for x in range(mastertable.shape[0]):
if updatetable[y].s_date <= mastertable[x].index <= updatetable[y].e_date:
mastertable[x].field2 = updatetable[y]. field2
mastertable[y].field3 = updatetable[y]. field3
我也有这种迭代技术:
for index, row in mastertable.iterrows():
print (row['Value'], index)
for index, row in updatetable.iterrows():
print (row['field1'], row['field2'])
我正在遵循如何在VBA中编写此代码:
For x = 1 to lastrow_update
for y = 1 to lastrow_master
if update(x,1) <= master(y,1) and master(y,1) <= update(x,2) then
master (y,2) = update(x,3)
我在使用python代码时遇到了错误。1)如何为“ for循环”创建两个控制变量2)如何在匹配后减少内部循环以减少运行时间
陪伴而非守候
温温酱
相关分类