Join two DataFrames where the join key is different and only select some columns

前端 未结 3 636
别跟我提以往
别跟我提以往 2021-01-19 04:12

What I would like to do is:

Join two DataFrames A and B using their respective id columns a_id and b_id<

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-19 04:42

    I think the easier solution is just to join table A to table B with selected columns you want. here is a sample code to do this:

    joined_tables = table_A.join(table_B.select('col1', 'col2', 'col3'), ['id'])
    

    the code above join all columns from table_A and columns "col1", "col2", "col3" from table_B.

提交回复
热议问题