I have changed the script following Stev's answer. The error no longer applies.
#import pandas as pd import requests import json import csv outfile = open('D:\\test.csv','w') url = '' resp = requests.get(url) data = json.loads(resp.content.decode('UTF8')) for d in data['data']: for r in d['rows']: for sd in (d['rows']): for td in (sd['data']): dparsed = sd['data'] w = csv.DictWriter(outfile, dparsed.keys()) w.writeheader() w.writerow(dparsed)
I ran the script and it created the csv file, but it is showing 0 KB and is saying it is locked by another user so I don't know exactly what I have goofed up this time. This is clearly not a duplicate question, so thanks for flagging it as such... /s
I ran the above script and after about 3 hours of waiting I killed spyder to see what happened with the excel file. It kind of worked, but it only managed to spit out some of the data into columns and about like 3 rows. Not sure where I fell down yet.