I think you need rename
like mentioned @wwnde in comments:
df = df1.append(df2.rename(columns={'C':'A','D':'B'}), ignore_index=True)
Or:
df = pd.concat([df1, df2.rename(columns={'C':'A','D':'B'})], ignore_index=True)
If need set columns dynamic by dictionary created from columns names with zip
:
d = dict(zip(df2.columns, df1.columns))
df = df1.append(df2.rename(columns=d), ignore_index=True)
print (df)
A B
0 a 0
1 a 1
2 a 2
3 c 4
4 c 5
5 c 6
EDIT:
df1 = pd.DataFrame({ 'A': ['a1','a2','a3'], 'B': range(3), 'C': ['c1','c2','c3'], 'D': ['4','5','6'] })
df = df1[['A','B']].append(df1[['C','D']].rename(columns={'C':'A','D':'B'}), ignore_index=True)
print (df)
A B
0 a1 0
1 a2 1
2 a3 2
3 c1 4
4 c2 5
5 c3 6
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…