1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] How can I do an outer join on two columns

Discussão em 'Python' iniciado por Stack, Setembro 15, 2024.

  1. Stack

    Stack Membro Participativo

    So I have 2x Polars DF, both containing the columns AuctionId and RealmName. I want to find all the rows which does not exist in one another based on the AuctionId and RealmName combination. Hopefully the below answer can help :)

    import polars as pl

    dfdata = {"AuctionId": [2084868458, 2085008809, 2087827052, 2087835700, 2087827999, 2087827997],
    "RealmName": ['Gehennas', 'Gehennas', 'Mograine', 'Lakeshire', 'Gehennas', 'Bloodfang']}

    df1data = {"AuctionId": [2084868458, 2085008342, 2087827052, 2087833212, 2087827999, 2087812997],
    "RealmName": ['Gehennas', 'Gehennas', 'Mograine', 'Lakeshire', 'Gehennas', 'Bloodfang']}

    resultdata = {"AuctionId": [2085008342, 2087833212,2087812997],
    "RealmName": [ 'Gehennas', 'Lakeshire', 'Bloodfang']}

    df = pl.DataFrame(dfdata)
    df1 = pl.DataFrame(df1data)
    resultdf = pl.DataFrame(resultdata)
    print(resultdf)

    Continue reading...

Compartilhe esta Página