我有两个Excel工作表,其中包含标签“列名”,“别名”,“表”。别名在这两个excel工作簿中都很常见。
File1.xlsx
TABLE ALIAS
Employee ON
Department Dept
Customer Cust
File2.xlsx
ALIAS COLUMN
Employee EmpID
Dept DeptName
Dept DeptID
Employee EmpName
这里的逻辑应如下所示:
代码
dfFile1 = pd.read_excel("File1.xlsx")
dfFile2 = pd.read_excel("File2.xlsx")
if(dfFile1.Alias == "ON"):
if(dfFile1.Table.value == dfFile2.ALias.value):
# some code
to merge "TABLE" && "COLUMN"```
The output should like below
TABLE COLUMN
Employee EmpID
Employee EmpName