gpt4 book ai didi

python - python pd.DataFrame( {'Dokuman' : docs, 'Sinif' : 类}) 中的 Pandas 数据框问题

转载 作者:太空宇宙 更新时间:2023-11-03 21:03:39 25 4
gpt4 key购买 nike

I want to create a 2-dimensional tagged data frame. But I every time get a different error.

I use the data as in the picture. sql server query output

docs in json data

我在下面编写的代码

docs = json.loads(docs)
classes = ['internet', 'arıza', 'kesinti', 'fatura', 'fatura',
'telefon', 'spor', 'ekonomi']

#df_docs = pd.DataFrame({'Dokuman': docs, 'Sinif': classes})
#df_docs= pd.Series([docs, classes], index=['Dokuman','Sinif'])
#df_docs = pd.DataFrame.from_dict(docs)
#df_docs = pd.DataFrame({'Dokuman': docs, 'Sinif': classes})

如何在此处设置数据框?

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

使用此代码时出现错误

最佳答案

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

问题已改善

关于python - python pd.DataFrame( {'Dokuman' : docs, 'Sinif' : 类}) 中的 Pandas 数据框问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55561799/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com