EX:
[ Column reference x new column remove special characters in a new column using pandas dataframe]
EX:
[ Column reference x new column remove special characters in a new column using pandas dataframe]
Speak, my dear, good morning, how are you?
If I understand what you want, it can be done this way:
tabela['NOVACOL'] = tabela['COLUNAREF'].apply(lambda x: x.replace('/','')
.replace('.','')
.replace(';','')
.replace(' ',''))
You assign to a new column tabela['NOVACOL']
, the previous column tabela['COLUNAREF']
with a function applied with lambda, uses replace
with attributes, character you want to replace and replaced (empty).
I was unable to add the for loop in the lambda function, so it would replace the character to be removed by an iterator from a list of characters for example, which would make the code more pythonic and clean.
Hope it helps, hug.
Claudio.