remove spaces from numbers string in dataframe python code example
Example 1: python - removeempy space in a cell
data = pd.DataFrame({'values': [' ABC ', ' DEF', ' GHI ']})
values
0 ABC
1 DEF
2 GHI
data['values'].str.strip()
0 ABC
1 DEF
2 GHI
Example 2: python - remove exta space in column
df.Name = df.Column_Name.replace('\s+', ' ', regex=True)