相关疑难解决方法(0)

使用pandas快速删除标点符号

这是一个自我回答的帖子.下面我概述NLP域中的一个常见问题,并提出一些高效的方法来解决它.

通常需要在文本清理和预处理期间去除标点符号.标点符号定义为以下任何字符string.punctuation:

>>> import string
string.punctuation
'!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
Run Code Online (Sandbox Code Playgroud)

这是一个很常见的问题,并且在恶心之前就被问过了.最惯用的解决方案是使用熊猫str.replace.但是,对于涉及大量文本的情况,可能需要考虑更高性能的解决方案.

str.replace在处理数十万条记录时,有哪些优秀,高效的替代方案?

python regex string numpy pandas

48
推荐指数
3
解决办法
5392
查看次数

标签 统计

numpy ×1

pandas ×1

python ×1

regex ×1

string ×1