Generally, this error arises when you try to join or assign to a column when the index(row or column names) has duplicate values. If I'm understanding correctly, you are trying to join the column, so check if your rows have duplicate values. Also, check your original dataframe. It may possible that the duplicate is present in your original dataframe.
To find the duplicates in the original index, do this:
df[df.index.duplicated()]
If you accidentally have created a duplicate column then remove it. This will solve your error.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…