I am trying to remove all the characters from string in the DataFrame column but keep the comma but it still removes everything including the comma.
I know the question has been asked before but I tried many answers and all remove the comma as well.
df[new_text_field_name] = df[new_text_field_name].apply(lambda elem: re.sub(r"(@[A-Za-z0-9]+)|([^0-9A-Za-z \t])|(\w+:\/\/\S+)|^rt|http.+?", "", str(elem)))
sample text:
'100 % polyester, Paperboard (min. 30% recycled), 100% polypropylene',
the required output:
' polyester, Paperboard , polypropylene',