在Python3中从Dataframe删除标点符号

时间:2019-05-29 12:46:35

标签: python-3.x pandas

我有一个包含标点符号的数据框,我想删除它,但没有得到正确的解决方案。

下面是数据框,它是一个示例:

data = {'text':['Great! But we still have the punctuation and numbers.', 'my name is  %# &still  and numbers.', '&"$ value is, right']}
df = pd.DataFrame(data) 
df

我尝试了以下选项,但没有成功

df['text'] = df['text'].map(lambda value:re.sub(string.punctuation,'',value)) df

请提出删除标点符号的最佳方法, 请注意,我的数据帧包含n个标点符号的'!“#$%&\'()* +,-。/ :; <=>?@ [\] ^ _`{|}〜'。不会是一个大解决方案

0 个答案:

没有答案