[Python] Apache Spark left join python databricks

Discussão em 'Python' iniciado por Stack, Abril 22, 2025.

  1. Stack

    Stack Membro Participativo

    I have three dataframes in databricks and try to run a join on them (apache spark functions). I mainly was used to pandas dataframe join. My current code is:

    joined_df = df_1.join(df_2, df_1["RECONTRACT"] == df_2["RECONTRACT"], "left")
    joined_df = joined_df.join(df_3, joined_df["RENTOBJECT"] == df_3["RENTOBJECT"], "left")


    so my goal ist to join df_2 and df_3 to df_1 (both left joins)

    but i am getting the error:


    [AMBIGUOUS_REFERENCE] Reference RENTOBJECT is ambiguous, could be: [RENTOBJECT, RENTOBJECT, RENTOBJECT]. SQLSTATE: 42704
    ​

    could it be that I have a duplicate column? How can I avoid the error? In pandas i am used that a duplicate columns get rennamed to: column_x and column_y

    Continue reading...

Compartilhe esta Página