Notebook
f=open(file1) cf= csv.DictReader(f, delimiter=',') print(cf)with open(file1) as f: cf = csv.DictReader(f, delimiter=',') line=0 for row in cf: if line == 0: line +=1 for r in row.keys(): print(r, coltype(r))
Base = automap_base() # reflect the tables in salish.sqlite: Base.prepare(engine, reflect=True) # mapped classes have been created Profs=Base.classes.profiles
s=select([prof.c.OBS_YEAR, prof.c.OBS_MONTH, prof.c.DEPTH_PRESS, prof.c.PSAL, prof.c.SSAL, prof.c.NTRA, func.case( [(prof.c.SSAL == 'NaN', prof.c.PSAL), (prof.c.SSAL != 'NaN', prof.c.SSAL) ]) ]).where( and_( prof.c.LATITUDE > 48.3, prof.c.LATITUDE < 48.8, prof.c.LONGITUDE < 125.2, prof.c.LONGITUDE > 124.3, prof.c.NTRA != 'NaN', prof.c.PSAL !='NaN', ) ) conn.execute(s).fetchall()