我有两个EXCEL,我试图从exel1中获取第二列值,并通过在excel2中使用下划线将这些值连接在第二列中
Excel1:
Excel2:
循环时,我不会看到整排人
import pandas as pd
import os
file1= 'C:/Users/madhu/Desktop/Excel1.xlsx'
file2= 'C:/Users/madhu/Desktop/Book1.xlsx'
df1 = pd.read_excel(file1)
df2 = pd.read_excel(file2)
#df1.to_dict()
#df2.to_dict()
var=[]
print(df1)
print(df2)
for row,col in range(len(df1)):
for row1,col in range(len(df2)):
if row.isspace() == True:
var.append(df1[row])
return '_'.join(var)
elif row == row1:
var.append(df1[row])
return '_'.join(var)
else:
pass
有人能帮我吗?谢谢
IIUC!从df1中创建dict,并从df2中映射拆分的项目(S1和S2)。参考下面的代码
我假设“用户电话号码”需要“us_pn”作为变量。我还假设代码不需要返回任何值
如果我的假设有任何错误,那么一定要让我知道,我会相应地修改代码
相关问题 更多 >
编程相关推荐