Jan-10-2022, 04:42 PM
I have a column called 'cnpjfornecedor' the original value is 08.482.581/0001-57 i need to remove the special caracters to have 08482581000157
i'm using this code
the result in jupyter is showing the right answer but when i save the new file using this code:
8,48258E+12 in the cell and 8482581000157 in the line.
idk why it removes the first caracter that is 0 and how can i set to show the right value in the column?
i'm using this code
## /*-+.,<>;:\'@#$%¨&"=()+ and strip á é í ó ú
#ficou fora = valorvenda, valorcusto, codfranqueadora,unidademedida, percroyalties,
dados1 = {'\\': '', '*': '', '-': ' ','+': '', '.': '', ',': '', '<': '', '>': '', ';': '', ':': '','\'': '', '@': '', '#': '',
'$': '', '%': '', '¨': '', '&': '', '=': '', '(': '', ')': '', 'á': 'a', 'é': 'e', 'í': 'i', 'ó': 'o', 'ú': 'u',
'Á': 'A', 'É': 'E', 'Í': 'I', 'Ó': 'O', 'Ú': 'U'}
dados2 = {'/': '', '-': '', '.': '', ',': ''}
for old, new in dados1.items():
df['modelo']=df['modelo'].str.replace(old, new, regex=False)
df['referencia']=df['referencia'].str.replace(old, new, regex=False)
df['ean']=df['ean'].replace(old, new, regex=False)
df['codncm']=df['codncm'].replace(old, new)
df['descricao']=df['descricao'].str.replace(old, new, regex=False)
df['cor']=df['cor'].str.replace(old, new, regex=False)
df['tamanho']=df['tamanho'].replace(old, new, regex=False)
df['linha']=df['linha'].str.replace(old, new, regex=False)
df['artigo']=df['artigo'].str.replace(old, new, regex=False)
df['genero']=df['genero'].str.replace(old, new, regex=False)
df['material']=df['material'].str.replace(old, new, regex=False)
df['faixa']=df['faixa'].str.replace(old, new, regex=False)
df['colecao']=df['colecao'].str.replace(old, new, regex=False)
df['origem']=df['origem'].str.replace(old, new, regex=False)
df['marca']=df['marca'].str.replace(old, new, regex=False)
df['compartigo']=df['compartigo'].replace(old, new, regex=False)
df['cnpjloja']=df['cnpjloja'].replace(old, new, regex=False)
for old, new in dados2.items():
df['cnpjfornecedor']=df['cnpjfornecedor'].str.replace(old, new, regex=False) the result in jupyter is showing the right answer but when i save the new file using this code:
df.to_csv('finalfodastico.csv', sep=';', index=False)the value that shows in the csv column is:8,48258E+12 in the cell and 8482581000157 in the line.
idk why it removes the first caracter that is 0 and how can i set to show the right value in the column?
