projdataReader = csv.reader(open(csv_filepathname2), dialect='excel-tab') ratdataReader = csv.reader(open(csv_filepathname3), dialect='excel-tab') for i,row in enumerate(profdataReader): prof = Professor() prof.netid = row[0] prof.title = row[2] prof.office = row[6] prof.phone = row[7] prof.research_areas = row[9] prof.research_topics = row[10] prof.research_links = row[11] prof.description = row[13] prof.full = row[14] prof.name = row[1] prof.department = row[3] prof.email = row[5] prof.image = row[4] prof.website_link = row[12] prof.save() for i,row in enumerate(projdataReader): proj = Project() try: proj.professor=Professor.objects.get(netid=row[1]) except: continue