小编Niz*_*Khs的帖子

将数据帧转换为在flask python中作为“application-json”返回

  dfList = df.values.tolist()
  return jsonify(dfList)
Run Code Online (Sandbox Code Playgroud)

我有这个结果,它实际上是删除 DataFrame 的变量名称并用整数替换它们

-0: [
  0: "Les abeilles sont dehors",
  1: "ObservationNature",
  2:  0.6790075732725341,
  3:  [],
],
-1:[
  0: "elle sont allée chercher le miel à coté des fleurs du rucher",
  1: "ObservationNature",
  2: 0.4250480624587389,
  3: [],
]
Run Code Online (Sandbox Code Playgroud)

我的结果应该是这样的,带有 DataFrame 中的变量

-0: [
  "texte": "Les abeilles sont dehors",
  "type": "ObservationNature",
  "nluScore":  0.6790075732725341,
  "ruche":  [],
],
-1:[
  "texte": "elle sont allée chercher le miel à coté des fleurs du rucher",
  "type": "ObservationNature",
  "nluScore": 0.4250480624587389,
  "ruche": [], …
Run Code Online (Sandbox Code Playgroud)

python pandas

9
推荐指数
3
解决办法
7402
查看次数

标签 统计

pandas ×1

python ×1