mylist=[]
for mycollege_id in college_id['id']:
mydf='df_'+str(mycollege_id)
query = ('select name, marks, ( case when first_pref=%s then 1 when second_pref = %s then 2 when third_pref = %s then 3 else 0 end ) as mypref from students having mypref > 0 order by marks desc') % (mycollege_id, mycollege_id, mycollege_id)
mydf=pd.read_sql(query, conn)
mylist.append(mydf)
print mylist