Remove double space and replace with a single one in pandas
You might be looking for pd.Series.str.replace
:
df.postcode = df.postcode.str.replace(' ', ' ')
this should replace all multiple spaces with a single space
df.postcode = df.postcode.str.replace(' +', ' ')
remove all spaces from the start and end
df.postcode = df.postcode.str.strip()