I have a script which writes the lat/lng of a JSON web service of bus routes. The script writes the latitude and longitude to a CSV correctly. However my table to table conversion does not work correctly in Python.
# IMPORTS#Make Python understand how to read things on the Internetimport urllib2#Make Python understand the stuff in a page on the Internet is JSONimport jsonfrom decimal import Decimal# Make Python understand csvsimport csv# Make Python know how to take a break so we don't hammer API and exceed rate limitfrom time import sleep# tell computer where to put CSVoutfile_path='C:\Users\Administrator\PycharmProjects\untitled\json2fgdb.csv'# open it up, the w means we will write to itwriter = csv.writer(open(outfile_path, 'wb'))#create a list with headings for our columnsheaders = ['latitude', 'longitude']#write the row of headings to our CSV filewriter.writerow(headers)# GET JSON AND PARSE IT INTO DICTIONARY# We need a loop because we have to do this for every JSON file we grab#set a counter telling us how many times we've gone through the loop, this is the first time, so we'll set it at 1i=1#loop through pages of JSON returned, 100 is an arbitrary numberwhile i
# IMPORTS#Make Python understand how to read things on the Internetimport urllib2#Make Python understand the stuff in a page on the Internet is JSONimport jsonfrom decimal import Decimal# Make Python understand csvsimport csv# Make Python know how to take a break so we don't hammer API and exceed rate limitfrom time import sleep# tell computer where to put CSVoutfile_path='C:\Users\Administrator\PycharmProjects\untitled\json2fgdb.csv'# open it up, the w means we will write to itwriter = csv.writer(open(outfile_path, 'wb'))#create a list with headings for our columnsheaders = ['latitude', 'longitude']#write the row of headings to our CSV filewriter.writerow(headers)# GET JSON AND PARSE IT INTO DICTIONARY# We need a loop because we have to do this for every JSON file we grab#set a counter telling us how many times we've gone through the loop, this is the first time, so we'll set it at 1i=1#loop through pages of JSON returned, 100 is an arbitrary numberwhile i