小编pan*_*das的帖子

将 2 个数据帧附加在一起并在附加时增加排名

我有 2 个数据框

数据框1:

index cust_id   rank opt
0   customer_1  1   test1
2   customer_1  2   test3 
3   customer_1  3   test4
4   customer_2  1   test1
5   customer_2  2   test4   
7   customer_2  3   test3   
9   customer_3  1   test3   
10  customer_3  2   test4   
11  customer_3  3   test1
Run Code Online (Sandbox Code Playgroud)

数据框2:

index cust_id rank opt
1   customer_1  1  new_opt
2   customer_2  2  new_opt
3   customer_3  3  new_opt
Run Code Online (Sandbox Code Playgroud)

我想将这两个数据帧合并在一起并获得如下输出:

index cust_id   rank opt
0   customer_1  1   new_opt
1   customer_1  2   test1
2   customer_1  3   test3 
3   customer_1 …
Run Code Online (Sandbox Code Playgroud)

python append rank pandas

3
推荐指数
1
解决办法
746
查看次数

标签 统计

append ×1

pandas ×1

python ×1

rank ×1