【问题标题】:Pandas value error when converting JSON into an excel将 JSON 转换为 excel 时出现 Pandas 值错误
【发布时间】:2019-06-01 01:13:39
【问题描述】:

JSON 文件:-

 {"customer_name":"james",
   "customer_id":41
 }

我下面的 Python 代码给出了错误消息:-

  " ValueError: If using all scalar values, you must pass an index "

请告诉我以下代码中的问题。

import pandas
pandas.read_json("p1.json").to_excel("out-put.xlsx")

【问题讨论】:

  • 这个问题可能是无法输入的原因

标签: python json python-3.x pandas


【解决方案1】:

你可以试试:

pandas.read_json("p1.json", typ = 'series')

它创建 pd.Series

【讨论】:

  • TypeError: read_json() got an unexpected keyword argument 'type'
  • 对不起,这是典型
猜你喜欢
  • 2022-07-22
  • 1970-01-01
  • 2022-11-07
  • 2016-12-18
  • 2023-01-12
  • 1970-01-01
  • 2016-09-08
  • 2016-11-13
  • 1970-01-01
相关资源
最近更新 更多