I have two dataframes:
In df1, i got an order of id's assigned to people, each person can have at most 2 id's:
df1:
id1 id2
2040 0
2041 2050
2042 0
2043 0
2044 2051
2045 2052
In df2, i got a list of payments and id's for these people but not arranged:
df2:
id amount
2040 10
2040 10
2053 5
2043 5
2052 10
2045 5
What i'm looking for is a way to create a df3 that organizes payments in the specific order of the df1 taking in consideration the possibillity of a person paying more than once: Example:
df3:
id1 id2 payment
2040 0 20
2041 2050 0
2042 0 0
2043 0 5
2044 2051 0
2045 2052 15
and a df4 if there is any id in df2 that doesn't exist in df1 for future correction
df4:
id amount
2053 5