如何在pandas中连接两个具有不同列的数据帧,将列标题也作为行传递到没有标题的新数据帧中。结果_df是所需的格式
similar issue这里的列计数保持不变,这不是这里需要的
>df_may
id quantity attr_1 attr_2
0 1 20 0 1
1 2 23 1 1
2 3 19 1 1
3 4 19 0 0
>df_jun
id2 quantity2 attr_12
0 5 8 1
1 6 13 0
2 7 20 1
3 8 25 1
>result_df
0 id quantity attr_1 attr_2
1 1 20 0 1
2 2 23 1 1
3 3 19 1 1
4 4 19 0 0
5 id2 quantity2 attr_12
6 5 8 1
7 6 13 0
8 7 20 1
9 8 25 1
你试过了吗
相关问题 更多 >
编程相关推荐