my dataframe, data, looks like this
ID Query email phone
1 hi [] []
2 email is johnsmith@gmail.com [johnsmith@gmail.com] []
3 phone no is 12345678790 [] [12345678790]
I want to create a column called masked query which will look like this
ID Query email phone masked_query
1 hi [] [] [hi]
2 email is johnsmith@gmail.com [johnsmith@gmail.com] [] [email is XXXXXXXXXXXXXXXXXXX]
3 phone no is 12345678790 [] [12345678790] [phone no is XXXXXXXXXX]
The columns, email and phone, I have created using regex functions,I need to create a function to create this column 'masked_query' and mask the data but I don't know how to proceed with masking the data. Any help is appreciated.