标签: python json pandas
如何在 python pandas 中做这些事情? 我正在尝试向某些 API 发出 put 请求,但不确定如何生成请求正文,因为我只有 csv 文件。请求正文要求固定的模式集
答案 0 :(得分:1)
Dataframe 有一个函数 to_dict。
to_dict
documents = df.to_dict(orient='records') result = {'items': documents}