Concat (Merge) Python Pandas中的不对称数据框架表来创建关系表



我有两个表,Table1和Table2

Table1:

<表类> Key1 Key2 tbody><<tr>A1B1

您可以尝试交叉合并:

df_out = pd.merge(df1, df2, how="cross")[["Key2", "Key4"]]
print(df_out)

打印:

Key2 Key4
0   B1   D1
1   B1   D2
2   B1   D3

最新更新