Sort one dataframe by another



    Rosie Djurovic

    The code first sets the index on df1 to 'Project' and then reindexes the dataframe. It then resets the index.

    df1 = df1.set_index('Project')
    df1 = df1.reindex(index=df2['Project'])
    df1 = df1.reset_index()
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.