【发布时间】:2020-11-15 14:49:27
【问题描述】:
这是我的series,它已被标记并删除了停用词:
0 [laptop, sits, 4, stars, similarly, priced, co...
1 [ordered, monitor, wanted, makeshift, area, po...
2 [monitor, great, deal, price, size, ., use, of...
3 [bought, height, adjustment, ., swivel, abilit...
4 [worked, month, died, ., 5, calls, hp, support...
...
30618 [great, deal]
30619 [pour, le, travail]
30620 [business, use]
30621 [good, size]
30622 [pour, mon, ordinateur.plus, grande, image.vra...
Name: text_body, Length: 30623, dtype: object
我想从上述系列中删除标点符号。我曾尝试过这样的事情
filtered_text = re.sub(r'[^\w\s]','',str(series))
结果以字符串形式出现。
我有 2 个问题。
- 有没有办法将
filtered_text字符串转换回列表或系列? - 有没有更好的方法从原始系列中删除标点符号?
【问题讨论】:
标签: python pandas nlp data-cleaning