Mask few columns in dataframe in Pandas

In pandas, replace function can be used to mask few columns data.

Example : Masks phone number data in column1 and column2 of the data frame
df[['column1','column2']] = df[['column1','column2']].replace('([2-9]\d{2}-\d{3}-\d{4})|(\d{10})|(\+?\d{2}\s+-?\s+\d{10})', 'MASKED', regex=True)