I am having raw input in text format having special characters in string.I want to change these special character from strings so that after running code there will not be any special character in it.
I tried to write below code.I am not sure whether it is right or wrong.
def avoid(x):
#print(x)
#value=[]
for ele in range(0, len(x)):
p=invalidcharch(ele)
#value.append(p)
#value=''.join(p)
print(p)
return p
def invalidcharch(e):
items={"ä":"a","ç":"c","è":"e","º":"","Ã":"A","Í":"I","í":"i","Ü":"U","â":"a","ò":"o","¿":"","ó":"o","á":"a","à":"a","õ":"o","¡":"","Ó":"O","ù":"u","Ú":"U","´":"","Ñ":"N","Ò":"O","ï":"i","Ï":"I","Ç":"C","À":"A","É":"E","ë":"e","Á":"A","ã":"a","Ö":"O","ú":"u","ñ":"n","é":"e","ê":"e","·":"-","ª":"a","°":"","ü":"u","ô":"o"}
for i, j in items.items():
e = e.replace(i, j)
return e
for col in df.columns:
df[col]=df[col].apply(lambda x:avoid(x))
but in above code I am unable to store whole string in variable p.I need to store whole string value in p so that it will store replace cell value. Data containing mix datatype values like string integer.
col A
Junto à Estação de Carcavelos;
Bragança
Situado en el núcleo de Es Caló de Sant Agustí frente al Hostal Rafalet.
Cartão MOBI.E
R. Conselheiro Emídio Navarro (frente ao ISEL)
After chnage
Junto a Estacao de Carcavelos;
Braganca
Situado en el nucleo de Es Calo de Sant Agusti frente al Hostal Rafalet.
Cartao MOBI.E
R. Conselheiro Emidio Navarro (frente ao ISEL)