To count and sort and detect table name in SQLite 3 database to use python. -
i have stock daily data contains 2410 tables. each table name stock's code number. database name datatbak.db , structure of table this:
->head(5)
date volume open high low close 0 20160509 312894.0 1290000.0 1300000.0 1285000.0 1299000.0 1 20160510 171191.0 1299000.0 1300000.0 1288000.0 1296000.0 2 20160511 176688.0 1296000.0 1299000.0 1287000.0 1292000.0 3 20160512 152302.0 1292000.0 1292000.0 1275000.0 1281000.0 4 20160513 245698.0 1281000.0 1281000.0 1251000.0 1253000.0 diff_close 0 nan 1 -0.002309 2 -0.003086 3 -0.008514 4 -0.021858
diff_close rise / fall rate. made through pandas df.pct_change() function.
and want work on data frame.
first, want detect number of items , table names able n% returns specific date specific date. example, call table names of stocks rose 7% month.
the result seems way:
394 a005930, a003150, a000020, ···········
and sort number of times rate of return(during 1 month) more 7% in descending order. example
cnt = number of times 7% return recorded month count = number of eligible items
cnt count 18 4 17 6 16 8 15 5 14 10 13 9 . . . . . .
how can achieve using python? appreciate hint. not sure if better create new data frame of yield month.
Comments
Post a Comment