Python Pandas: How do I add a ‘+’ sign before phone number in a pandas dataframe?

I have a pandas dataframe with a column phone. The column contains phone numbers. I want to add a ‘+’ before every number. How can I achieve this?

Right now I add an extra column to add both columns together but there must be a better way without creating an extra column. I’d be happy to learn more about this.

country_code = "+852"
df.phone = country_code + df.phone

Thanks already in regards.

Answer

You can just concatenate and replace the old columns. need to convert phone to string if it isn’t one.

country_code = "+852"
df['phone'] = country_code + df['phone'].map(str)