Skip to content

Instantly share code, notes, and snippets.

@aepyornis
Created March 19, 2015 20:07
Show Gist options
  • Save aepyornis/43376cb20d18f939a990 to your computer and use it in GitHub Desktop.
Save aepyornis/43376cb20d18f939a990 to your computer and use it in GitHub Desktop.
# get bbls
import glob
import csv
def get_bbl(row):
return row[69] + ','
# create file to store bbls
bbl_file = open('./all_bbls.csv', 'w')
# get all pluto csvs - change filepath as needed
list_of_files = glob.glob('./data/pluto/*.csv')
# iterate through files
for path in list_of_files:
with open(path) as f:
# ignore first line
next(f)
# handle file as CSV
reader = csv.reader(f, delimiter=',', quotechar='"')
# write bbl for each row
for row in reader:
bbl_file.write(get_bbl(row))
# close bbl_file
bbl_file.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment