I have dataframe with unique identifier assigned based on three columns i.e., [col2,col3,col3]
Dataframe1:
col1 col2 col3 col4 col5 unique_id
1 abc bcv zxc www.com 8
2 bcd qwe rty www.@com 12
3 klp oiu ytr www.io 15
4 zxc qwe rty www.com 6
After data preprocessing, will import Dataframe_2 with same column values as shown above but without unique_id. Dataframe_2 rows must be assigned with unique identifier based on col2,col3,col4 and by referring to the Dataframe1.
If Dataframe_2 has new row which is not present in Dataframe1, then assign new identifier.
Dataframe_2:
col1 col2 col3 col4 col5
1 bcd qwe rty www.@com
2 zxc qwe rty www.com
3 abc bcv zxc www.com
4 kph hir mat www.com
Expected Dataframe_2:
col1 col2 col3 col4 col5 unique_id
1 bcd qwe rty www.@com 12
2 zxc qwe rty www.com 6
3 abc bcv zxc www.com 8
4 kph hir mat www.com 35
Since Row4 is not present in Dataframe1, a new unique identifier is assigned.
question from:
https://stackoverflow.com/questions/65914677/assign-unique-identifier-for-dataframe-rows-based-on-dataframe-with-preassigned 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…