'How to join a column with duplicate names in python?

I have two tables that I need to join in python. I have multiple columns that have the same name; however, I want to change the name ADDING A number suffix.

type extension
A 'url': 'https:table1
D 'url': 'https:table2
type extension
A 'url': 'https:
D 'url': 'https:
# My current code that gets an error because the join has duplicate names
df1 = (pd.concat({i: pd.DataFrame(x) for i, x in df22.pop('careTeam').items()})
         .reset_index(level=1, drop=True)
        .join(df22)
         .reset_index(drop=True))

Error message:columns overlap but no suffix specified: Index(['type','extension'], dtype='object')

Desired output table:

type1 extension1 type2 extension2
A 'url': 'https:' A 'url': 'https:table1
D 'url': 'https:' D 'url': 'https:table2


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source