ValueError: Shape of passed values is (10, 10000), indices imply (3, 10000)
错误原因是:
维度保持不一致,原来是(10,10000)自己写的时候就是(3,10000)维度了,将x维度改成10就好了,或者采用系统默认的0,1.。。。即可解决。
#原来的代码
Red_lda = pd.DataFrame(lda.components_,index=np.arange(n_topics)+1,columns=tf_vectorizer.get_feature_names())
#更改后的代码
Red_lda = pd.DataFrame(lda.components_)