FROM_GROUP_ID and TO_GROUP_ID are in one data set CALL_NUMBER is in the other.
I need to join them on FROM_GROUP_ID = CALL_NUMBER_ID and TO_GROUP_ID = CALL_NUMBER_ID. These columns all have the same ID's.
I tried using this:
master_df = pd.merge(group_df,call_df,on = ["TO_GROUP_ID = CALL_NUMBER_ID" and "FROM_GROUP_ID = CALL_NUMBER_ID"])
I keep getting an error, any suggestions?
assign
一个新列(相同值CALL_NUMBER
)
master_df = pd.merge(group_df,call_df.assign(col=call_df['CALL_NUMBER_ID']),left_on=['TO_GROUP_ID','FROM_GROUP_ID'],right_on=['CALL_NUMBER_ID','col'])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.