【发布时间】:2020-06-20 21:22:28
【问题描述】:
以下是我在 jupyter notebook 中使用的代码。但是,运行代码时出现一个错误。你能帮我调试一下错误吗?
def split(string, delimiters= [" ","_",":"], maxsplit=0):
regexPattern = '|'.join(map(re.escape, delimiters))
string = re.sub('\d','',string)
string = re.sub(r'\W+', ' ', string)
string = camel_case_split(string)
str_spl = re.split(regexPattern, string, maxsplit)
return [x for x in str_spl if x != '' and len(x)>1 and x not in beast_labels and x.lower() not in stopwords]
documents['split_doc'] = documents['BrandMetric'].apply(lambda x: split(x))
documents['split_clean'] = documents['BrandMetric'].apply(lambda x: split(x))
错误:- 预期的字符串或类似字节的对象错误。
【问题讨论】: