Created
August 4, 2010 04:11
-
-
Save bensonk/507622 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| from pprint import pprint | |
| query = "insert into observations(beach, month, date, year, observer, effortid, " + \ | |
| "brand, sex, age, behavior, time, photoname, comments) values('%s', '%s', " + \ | |
| "'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s');" | |
| rawdata = open("UgamakBrands2010.csv").readlines() | |
| for line in [ line.strip().split(",") for line in rawdata[1:] ]: | |
| print query % tuple(line) | |
| for record in [ line.strip().split(',') for line in open('behavior_rank.csv').readlines()]: | |
| print "insert into rankings (id, code, rank) values('%s', '%s', '%s');" % tuple(record) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment