def _clean(stock, conn):
try:
print "clean ------ :", stock
query = "select * from '%s' order by date" % stock
df = pd.read_sql(query, conn)
print "before",df.tail(5)
cur = conn.cursor()
query = "delete from '%s' where rowid not in(select max(rowid) from '%s' group by date)" % (stock, stock)
cur.execute(query)
conn.commit()
query = "select * from '%s' order by date" % stock
df = pd.read_sql(query, conn)
print "after",df.tail(5)
except Exception, arg:
print "exceptionc:", stock, arg
raise SystemExit(-1)
评论列表
文章目录