开发者社区 问答 正文

python中有相同行索引且没有重复列索引时的示例代码是什么?

python中有相同行索引且没有重复列索引时的示例代码是什么?

展开
收起
游客qzzytmszf3zhq 2021-11-30 16:06:20 380 分享 版权
1 条回答
写回答
取消 提交回答
  • # 以左表df1的index为依据,进行左连接,右表df2的indexC被忽略;
    print("df1.index:\n", df1.index)
    print()
    df1_new = df1.join(df2)
    df1_new
    1
    2
    3
    4
    5
    df1.index:
     Index(['A', 'B'], dtype='object')
    
    
    2021-11-30 16:06:50
    赞同 展开评论
问答分类:
问答地址: