0
EX:
[ Reference column x New column remove special characters in a new column using dataframe pandas]
0
EX:
[ Reference column x New column remove special characters in a new column using dataframe pandas]
0
Speak my dear, good morning, all right?
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, use the replace
with the attributes, character you want to replace and substitude(empty) .
I couldn’t add the loop for in the lambda function, so it replaces the character to be removed with an iterator from a character list for example, which would make the code more pythonic and clean.
I hope it helps, hug.
Claudio.
Browser other questions tagged python
You are not signed in. Login or sign up in order to post.
This question is not part of the scope of this site. I suggest you read here: What kinds of questions should I avoid asking? and also read: How to ask
– user81560