Skip to main content
1 de 3
Sidon
  • 6,7mil
  • 1
  • 16
  • 31
import pandas as pd
rdata = {'NAME': ['   José           Luiz   da       Silva   ']}
df = pd.DataFrame(rdata, columns = ['NAME'])

for i, row in df.iterrows():
  df.set_value(i,'NAME',' '.join(row.NAME.split()))
  
print (df)  

Output:

    NAME
0  José Luiz da Silva

Execute no repl.it.

Sidon
  • 6,7mil
  • 1
  • 16
  • 31