:
:
import re
import string
rem = string.punctuation
pattern = r"[{}]".format(rem)
pattern
:
'[!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~]'
:
df = pd.DataFrame({'text':['book...regh', 'book...', 'boo,', 'book. ', 'ball, ', 'ballnroll"', '"rope"', 'rick % ']})
df
:
text
0 book...regh
1 book...
2 boo,
3 book.
4 ball,
5 ballnroll"
6 "rope"
7 rick %
:
df['text'] = df['text'].str.replace(pattern, '')
df
. Ex - replace (pattern, '$')
:
text
0 bookregh
1 book
2 boo
3 book
4 ball
5 ballnroll
6 rope
7 rick