v.k
v.k

Reputation: 151

Pandas value error when converting JSON into an excel

JSON File:-

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

my Python code below gives the error message :-

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

Please let me know what is the issue in the below code.

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

Upvotes: 2

Views: 139

Answers (1)

cors
cors

Reputation: 537

You can try:

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

It creates pd.Series

Upvotes: 2

Related Questions