【发布时间】:2020-04-25 07:52:03
【问题描述】:
给定一个句子“你好。我正在写一个问题”,我想在标点符号上拆分句子并将每个子句添加到 Pandas 中的单独列中,例如:
dummy = ['Hello', 'I am writing a question']
pd.DataFrame(dummy).T
并且我希望迭代地执行此操作,例如:
for subsentence in sentence:
subsentence = re.split(r'[.|,|?|!]', str(subsentence))
df['item'] = subsentence
但这确实会产生:
【问题讨论】: