I have a pair of columns, like so:
x = ["a b williams", "e g", "z z specialists"]
y = ["j j winston", "hb d party supplies", "t t ice cream"]
df = pd.DataFrame(x,y)
I would like to be able to remove the white space between two single characters using re.sub. I have tried the following:
re.sub("(?<=\\w\\b)"\\s"(?=\\w\\b)", "", df)
However, when I run the code, I get the following error.
SyntaxError: unexpected character after line continuation character
I'm unsure of what I am doing wrong. The desired result is:
jj winston ab williams
hb d party supplies eg
tt ice cream zz specialists
Please advise. Any advice is appreciated.