【发布时间】:2021-01-03 17:54:36
【问题描述】:
我有一个数据集enter image description here,我想创建一个带有标题和文本的单列。我试着写这样的代码:
df['text'] = df['title'] +" "+ df['text']
#Delete all the other columns.
del df['title'] # added to text corpus
del df['subject'] # it would affect results
del df['date']
但它不工作,我得到错误。 enter image description here
【问题讨论】:
-
你能做一个
df.columns并检查title前后是否有空格? -
另外,对以后的帖子的建议,只需复制并粘贴数据框而不是添加图像:)
标签: python machine-learning scikit-learn compiler-errors calculated-columns