“[Index(['', ''], dtype='object')] 都不在 [列] 中”

2024-01-06

我是 python 中的 panda 库出现错误

“[Index(['Dokuman', 'Sinif'], dtype='object')] 均不在 [列] 中”

classes = ['ekonomi', 'spor', 'teknoloji', 'teknoloji', 'saglik', 'saglik', 'spor', 'ekonomi']

df_docs = pd.DataFrame.from_dict({'Dokuman': docs, 'Sinif': classes}, orient='index')


df_docs = df_docs[['Dokuman', 'Sinif']] #throws the error here

the number of records in the docs is not equal to the number of records in the classes, so I am getting the error

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

“[Index(['', ''], dtype='object')] 都不在 [列] 中” 的相关文章

随机推荐