0
I am trying to replace words in a text that are formed, obligatorily, formed of letters and numbers.
I tried that:
def passwords():
df['C'] = df['C'].str.replace(r'[a-zA-Z0-9]', '<password>')
return df
My data:
A B C
Joana MG minha senha é aaabb123
Marcos AM eu tentei colocar a minha senha varias vezes
Paulo RS eu tenho duas senhas: 321cccppp e r1t2r3t4r5t
My result is horrible:
A B C
Joana MG <password><password><password><password>
Marcos AM <password><password><password><password><password><password>
Paulo RS <password><password><password><password><password><password>
Good output:
A B C
Joana MG minha senha é <password>
Marcos AM eu tentei colocar a minha senha varias vezes
Paulo RS eu tenho duas senhas: <password> e <password>