I'm writing a script in Python to transfer Excel Online data to GCP and I would like to replace \xa0 from strings inside column of DataFrame like '\xa0shopName' , '\xa0Street Adress', '\xa0'.
I've tried df = df.replace(u'\xa0', u''), but it's only replacing '\xa0', the strings with \xa0 and words stay the same. Maybe regex df = re.sub('#regular expression', '', df)will help, but i cannot find correct regex sentence :/
You can use
df = df.replace('\xa0', '', regex=True)
By passing the regex=True option, you trigger re.sub behind the scenes, that replaces all occurrences of non-breaking spaces with an empty string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With