If I have a string in a column that is separated by commas:
"apple, apple, banana, pear, apple"
How would I remove only consecutive duplicated words? My desired output would look like this:
"apple, banana, pear, apple"
The words in the string are separated by commas. I understand in [this post] How do I use itertools.groupby()? if the words are in a list this will work, but my issue is slightly different in that it is a single string and there are commas after each word. Thank you in advance.