eceret

In [25]:
import csv
import json
import getpass
import requests

ECE Ret

Parse csv file of New Zealand Early Childhood Services from Ministry of Education. Saves the files as a json file for each centre. The name is the ID of the centre.

https://www.educationcounts.govt.nz/data-services/directories/early-childhood-services

In [13]:
myusr = getpass.getuser()
In [14]:
#centlis = list()
In [15]:
#with open('/home/pi/Downloads/Directory-ECE-Current.csv', 'r') as ececur:
#    spamreader = csv.reader(ececur, delimiter=' ', quotechar='|')
#    for row in spamreader:
        #print (', '.join(row))
#        centlis.append(', '.join(row))
In [16]:
with open('/home/{}/Downloads/Directory-ECE-Current.csv'.format(myusr), 'r') as eceblah:
    reader = csv.DictReader(eceblah)
    
    for row in reader:
        #print(row['Name'])
        #diclis = dict({row['ID'] : row})
        #print(json.dumps(diclis))
        with open('/home/{}/ececentres/{}.json'.format(myusr, row['ID']), 'w') as ececen:
            ececen.write(json.dumps(row))
        
In [17]:
#centrelis
In [18]:
#lencen = len(centlis)
In [19]:
#lencen
In [20]:
#centen
In [21]:
#centen = centlis[10]
In [22]:
#cspli = centen.split(',')
In [23]:
#cspli[0:4]
In [24]:
#for lc in range(0, lencen):
#    print(centlis[lc])

Comments

Comments powered by Disqus