Question

While converting json file to csv,I got the above error My code is shown below:

import json
import csv
data = open("SRInFlow.json",encoding="utf8")
rows = json.loads(data.read())
r=rows.values()
fieldnames = [b'dateTimeValues', b'timeSeries']
with open('C:/DeepLearning/tensorflowpoc/Codes/SRInFlow.csv', 'w') as f:
    dict_writer = csv.DictWriter(f, fieldnames=fieldnames)
    dict_writer.writeheader()
    for d in r:
  --->    dict_writer.writerow(d)

The error displays in the last line. How to rectify the error? Thanks in advance

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with datascience.stackexchange
scroll top