在这里完成初学者!
我正在通过LDA跟踪关于文本挖掘的jupyter笔记本教程:
在本教程中,我有一个.txt文档:
data = data.drop('speech',1)
for i in range(ldaobj.K): data['T' + str(i)] = dt[:,i]
data.to_csv("final_output.csv",index=False)
然而,更进一步,我尝试切换语音'通过LDA找到的(估计)主题的列。此代码在教程中使用:
xrange()
(我将range()
切换为ValueError Traceback (most recent call last)
<ipython-input-31-45755ac70972> in <module>()
----> 1 data = data.drop('speech',1)
2 for i in range(ldaobj.K): data['T' + str(i)] = dt[:,i]
3 data.to_csv("final_output.csv",index=False)
/anaconda3/lib/python3.6/site-packages/pandas/core/generic.py in drop(self,
labels, axis, index, columns, level, inplace, errors)
2528 for axis, labels in axes.items():
2529 if labels is not None:
-> 2530 obj = obj._drop_axis(labels, axis, level=level,
errors=errors)
2531
2532 if inplace:
/anaconda3/lib/python3.6/site-packages/pandas/core/generic.py in
_drop_axis(self, labels, axis, level, errors)
2560 new_axis = axis.drop(labels, level=level,
errors=errors)
2561 else:
-> 2562 new_axis = axis.drop(labels, errors=errors)
2563 dropped = self.reindex(**{axis_name: new_axis})
2564 try:
/anaconda3/lib/python3.6/site-packages/pandas/core/indexes/base.py in
drop(self, labels, errors)
3742 if errors != 'ignore':
3743 raise ValueError('labels %s not contained in axis'
%
-> 3744 labels[mask])
3745 indexer = indexer[~mask]
3746 return self.delete(indexer)
ValueError: labels ['speech'] not contained in axis
,因为我使用的是Python 3)
现在,当我运行它时,它给了我:
/public/robots.txt #which is for domain.com
/public/robots-dev.txt #which is for dev.domain.com
.htaccess
我不确定错误是否足够,所以我发布了所有内容以确定。
你们中的任何人都知道为什么会弹出这个错误吗?