{ "cells": [ { "cell_type": "code", "execution_count": 3, "id": "139fd1cb-aedf-4186-8408-4d630ba69599", "metadata": {}, "outputs": [], "source": [ "import dolphindb as ddb\n", "\n", "sess = ddb.session(\"192.168.1.167\", 8848)\n", "sess.login('admin', '123456')" ] }, { "cell_type": "code", "execution_count": 42, "id": "86d6ce04-b5ae-410b-af8d-9d9b5d87a959", "metadata": {}, "outputs": [], "source": [ "sess.run(\"\"\"\n", " dropFunctionView('pit_at_date')\n", "\"\"\")" ] }, { "cell_type": "code", "execution_count": 43, "id": "5482fa63-23e7-48e7-9636-5628faef7b73", "metadata": {}, "outputs": [], "source": [ "sess.run(\"\"\"\n", "def pit_at_date(table_name, date, report_period_list, code_partition_id) {\n", "\tsource_table = loadTable(\"dfs://pit_stock_ts\", table_name);\n", "\t\n", "\tm_nDate = take(date, size(report_period_list));\n", "\treport_period = report_period_list;\n", "\t\n", "\tquery_table = table(report_period, m_nDate);\n", "\tquery_table_exp = select * from cj(query_table, select code from source_table where partition(code, code_partition_id) group by code map);\n", "\t\n", "\tsource_table_part = select source_table.* from ej(source_table, query_table_exp, `code`report_period) where partition(code, code_partition_id);\n", "\t\n", "\treturn select source_table_part.* from aj(query_table_exp, source_table_part, `code`report_period`m_nDate, `code`report_period`appear_at_date) where not isNull(source_table_part.code)\n", "}\n", "\n", "addFunctionView(pit_at_date)\n", "\"\"\")" ] }, { "cell_type": "code", "execution_count": 44, "id": "4e0eaa4d-80c9-4925-8496-a7d133fc0fda", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
appear_in_periodTOT_OPER_REVOPER_REVINT_INCINSUR_PREM_UNEARNEDHANDLING_CHRG_COMM_INCNET_INC_OTHER_OPSPLUS_NET_INC_OTHER_BUSPLUS_NET_GAIN_CHG_FVPLUS_NET_INVEST_INC...OTHER_INCOMEMEMOASSET_DISPOSAL_INCOMECONTINUED_NET_PROFITEND_NET_PROFITCREDIT_IMPAIRMENT_LOSSRD_EXPENSESTMNOTE_FINEXPFIN_EXP_INT_INCTOT_OPER_COST2
codereport_periodappear_at_date
000400.SZ2018-12-312019-03-292018-12-318.216559e+098.216559e+090.00.00.073932.940.00.073932.94...72773000.86nan0.002.737097e+080.00.03.350267e+0845075829.770.07.967406e+09
000558.SZ2018-12-312019-04-262018-12-317.024741e+087.024741e+080.00.00.023984753.520.00.023984753.52...10174473.66nan-12902036.23-5.424955e+070.00.00.000000e+0039309311.590.06.444387e+08
000677.SZ2018-12-312019-03-292018-12-317.068198e+087.068198e+080.00.00.0220497.760.00.0220497.76...1157100.00nan-1852690.976.403690e+060.00.03.514984e+055234360.370.06.821367e+08
000731.SZ2018-12-312019-04-162018-12-312.639920e+092.639920e+090.00.00.04467512.660.00.04467512.66...3477372.43nan1992627.872.228619e+080.00.01.653546e+0646581902.650.02.367904e+09
000752.SZ2018-12-312019-05-162018-12-313.231171e+083.231171e+080.00.00.0-43852162.570.00.0-43852162.57...136549.44nan0.00-3.830619e+080.00.00.000000e+000.000.03.135966e+08
........................................................................
688039.SH2018-12-312019-11-222018-12-312.035519e+082.035519e+080.00.00.0156599.670.00.0156599.67...15702563.93nan0.006.389806e+070.00.03.660990e+070.000.01.511902e+08
688368.SH2018-12-312019-09-172018-12-317.665912e+087.665912e+080.00.00.0972435.310.00.0972435.31...6568742.64nan0.000.000000e+000.00.06.081719e+070.000.06.890894e+08
688396.SH2018-12-312020-01-312018-12-316.270797e+096.270797e+090.00.00.010592096.660.00.010592096.66...91086261.29nan9434573.460.000000e+000.00.04.497610e+080.000.05.796301e+09
831010.NE2018-12-312020-07-012018-12-312.936331e+082.936331e+080.00.00.0262112.160.00.0262112.16...380000.00nan-258845.784.129632e+070.00.05.236440e+05254556.290.02.437095e+08
833874.NE2018-12-312020-06-292018-12-311.974978e+081.974978e+080.00.00.05841180.610.00.05841180.61...882100.00nan9554.969.051358e+070.00.01.092805e+070.000.01.021658e+08
\n", "

91 rows × 66 columns

\n", "
" ], "text/plain": [ " appear_in_period TOT_OPER_REV \\\n", "code report_period appear_at_date \n", "000400.SZ 2018-12-31 2019-03-29 2018-12-31 8.216559e+09 \n", "000558.SZ 2018-12-31 2019-04-26 2018-12-31 7.024741e+08 \n", "000677.SZ 2018-12-31 2019-03-29 2018-12-31 7.068198e+08 \n", "000731.SZ 2018-12-31 2019-04-16 2018-12-31 2.639920e+09 \n", "000752.SZ 2018-12-31 2019-05-16 2018-12-31 3.231171e+08 \n", "... ... ... \n", "688039.SH 2018-12-31 2019-11-22 2018-12-31 2.035519e+08 \n", "688368.SH 2018-12-31 2019-09-17 2018-12-31 7.665912e+08 \n", "688396.SH 2018-12-31 2020-01-31 2018-12-31 6.270797e+09 \n", "831010.NE 2018-12-31 2020-07-01 2018-12-31 2.936331e+08 \n", "833874.NE 2018-12-31 2020-06-29 2018-12-31 1.974978e+08 \n", "\n", " OPER_REV INT_INC \\\n", "code report_period appear_at_date \n", "000400.SZ 2018-12-31 2019-03-29 8.216559e+09 0.0 \n", "000558.SZ 2018-12-31 2019-04-26 7.024741e+08 0.0 \n", "000677.SZ 2018-12-31 2019-03-29 7.068198e+08 0.0 \n", "000731.SZ 2018-12-31 2019-04-16 2.639920e+09 0.0 \n", "000752.SZ 2018-12-31 2019-05-16 3.231171e+08 0.0 \n", "... ... ... \n", "688039.SH 2018-12-31 2019-11-22 2.035519e+08 0.0 \n", "688368.SH 2018-12-31 2019-09-17 7.665912e+08 0.0 \n", "688396.SH 2018-12-31 2020-01-31 6.270797e+09 0.0 \n", "831010.NE 2018-12-31 2020-07-01 2.936331e+08 0.0 \n", "833874.NE 2018-12-31 2020-06-29 1.974978e+08 0.0 \n", "\n", " INSUR_PREM_UNEARNED \\\n", "code report_period appear_at_date \n", "000400.SZ 2018-12-31 2019-03-29 0.0 \n", "000558.SZ 2018-12-31 2019-04-26 0.0 \n", "000677.SZ 2018-12-31 2019-03-29 0.0 \n", "000731.SZ 2018-12-31 2019-04-16 0.0 \n", "000752.SZ 2018-12-31 2019-05-16 0.0 \n", "... ... \n", "688039.SH 2018-12-31 2019-11-22 0.0 \n", "688368.SH 2018-12-31 2019-09-17 0.0 \n", "688396.SH 2018-12-31 2020-01-31 0.0 \n", "831010.NE 2018-12-31 2020-07-01 0.0 \n", "833874.NE 2018-12-31 2020-06-29 0.0 \n", "\n", " HANDLING_CHRG_COMM_INC \\\n", "code report_period appear_at_date \n", "000400.SZ 2018-12-31 2019-03-29 0.0 \n", "000558.SZ 2018-12-31 2019-04-26 0.0 \n", "000677.SZ 2018-12-31 2019-03-29 0.0 \n", "000731.SZ 2018-12-31 2019-04-16 0.0 \n", "000752.SZ 2018-12-31 2019-05-16 0.0 \n", "... ... \n", "688039.SH 2018-12-31 2019-11-22 0.0 \n", "688368.SH 2018-12-31 2019-09-17 0.0 \n", "688396.SH 2018-12-31 2020-01-31 0.0 \n", "831010.NE 2018-12-31 2020-07-01 0.0 \n", "833874.NE 2018-12-31 2020-06-29 0.0 \n", "\n", " NET_INC_OTHER_OPS \\\n", "code report_period appear_at_date \n", "000400.SZ 2018-12-31 2019-03-29 73932.94 \n", "000558.SZ 2018-12-31 2019-04-26 23984753.52 \n", "000677.SZ 2018-12-31 2019-03-29 220497.76 \n", "000731.SZ 2018-12-31 2019-04-16 4467512.66 \n", "000752.SZ 2018-12-31 2019-05-16 -43852162.57 \n", "... ... \n", "688039.SH 2018-12-31 2019-11-22 156599.67 \n", "688368.SH 2018-12-31 2019-09-17 972435.31 \n", "688396.SH 2018-12-31 2020-01-31 10592096.66 \n", "831010.NE 2018-12-31 2020-07-01 262112.16 \n", "833874.NE 2018-12-31 2020-06-29 5841180.61 \n", "\n", " PLUS_NET_INC_OTHER_BUS \\\n", "code report_period appear_at_date \n", "000400.SZ 2018-12-31 2019-03-29 0.0 \n", "000558.SZ 2018-12-31 2019-04-26 0.0 \n", "000677.SZ 2018-12-31 2019-03-29 0.0 \n", "000731.SZ 2018-12-31 2019-04-16 0.0 \n", "000752.SZ 2018-12-31 2019-05-16 0.0 \n", "... ... \n", "688039.SH 2018-12-31 2019-11-22 0.0 \n", "688368.SH 2018-12-31 2019-09-17 0.0 \n", "688396.SH 2018-12-31 2020-01-31 0.0 \n", "831010.NE 2018-12-31 2020-07-01 0.0 \n", "833874.NE 2018-12-31 2020-06-29 0.0 \n", "\n", " PLUS_NET_GAIN_CHG_FV \\\n", "code report_period appear_at_date \n", "000400.SZ 2018-12-31 2019-03-29 0.0 \n", "000558.SZ 2018-12-31 2019-04-26 0.0 \n", "000677.SZ 2018-12-31 2019-03-29 0.0 \n", "000731.SZ 2018-12-31 2019-04-16 0.0 \n", "000752.SZ 2018-12-31 2019-05-16 0.0 \n", "... ... \n", "688039.SH 2018-12-31 2019-11-22 0.0 \n", "688368.SH 2018-12-31 2019-09-17 0.0 \n", "688396.SH 2018-12-31 2020-01-31 0.0 \n", "831010.NE 2018-12-31 2020-07-01 0.0 \n", "833874.NE 2018-12-31 2020-06-29 0.0 \n", "\n", " PLUS_NET_INVEST_INC ... \\\n", "code report_period appear_at_date ... \n", "000400.SZ 2018-12-31 2019-03-29 73932.94 ... \n", "000558.SZ 2018-12-31 2019-04-26 23984753.52 ... \n", "000677.SZ 2018-12-31 2019-03-29 220497.76 ... \n", "000731.SZ 2018-12-31 2019-04-16 4467512.66 ... \n", "000752.SZ 2018-12-31 2019-05-16 -43852162.57 ... \n", "... ... ... \n", "688039.SH 2018-12-31 2019-11-22 156599.67 ... \n", "688368.SH 2018-12-31 2019-09-17 972435.31 ... \n", "688396.SH 2018-12-31 2020-01-31 10592096.66 ... \n", "831010.NE 2018-12-31 2020-07-01 262112.16 ... \n", "833874.NE 2018-12-31 2020-06-29 5841180.61 ... \n", "\n", " OTHER_INCOME MEMO \\\n", "code report_period appear_at_date \n", "000400.SZ 2018-12-31 2019-03-29 72773000.86 nan \n", "000558.SZ 2018-12-31 2019-04-26 10174473.66 nan \n", "000677.SZ 2018-12-31 2019-03-29 1157100.00 nan \n", "000731.SZ 2018-12-31 2019-04-16 3477372.43 nan \n", "000752.SZ 2018-12-31 2019-05-16 136549.44 nan \n", "... ... ... \n", "688039.SH 2018-12-31 2019-11-22 15702563.93 nan \n", "688368.SH 2018-12-31 2019-09-17 6568742.64 nan \n", "688396.SH 2018-12-31 2020-01-31 91086261.29 nan \n", "831010.NE 2018-12-31 2020-07-01 380000.00 nan \n", "833874.NE 2018-12-31 2020-06-29 882100.00 nan \n", "\n", " ASSET_DISPOSAL_INCOME \\\n", "code report_period appear_at_date \n", "000400.SZ 2018-12-31 2019-03-29 0.00 \n", "000558.SZ 2018-12-31 2019-04-26 -12902036.23 \n", "000677.SZ 2018-12-31 2019-03-29 -1852690.97 \n", "000731.SZ 2018-12-31 2019-04-16 1992627.87 \n", "000752.SZ 2018-12-31 2019-05-16 0.00 \n", "... ... \n", "688039.SH 2018-12-31 2019-11-22 0.00 \n", "688368.SH 2018-12-31 2019-09-17 0.00 \n", "688396.SH 2018-12-31 2020-01-31 9434573.46 \n", "831010.NE 2018-12-31 2020-07-01 -258845.78 \n", "833874.NE 2018-12-31 2020-06-29 9554.96 \n", "\n", " CONTINUED_NET_PROFIT END_NET_PROFIT \\\n", "code report_period appear_at_date \n", "000400.SZ 2018-12-31 2019-03-29 2.737097e+08 0.0 \n", "000558.SZ 2018-12-31 2019-04-26 -5.424955e+07 0.0 \n", "000677.SZ 2018-12-31 2019-03-29 6.403690e+06 0.0 \n", "000731.SZ 2018-12-31 2019-04-16 2.228619e+08 0.0 \n", "000752.SZ 2018-12-31 2019-05-16 -3.830619e+08 0.0 \n", "... ... ... \n", "688039.SH 2018-12-31 2019-11-22 6.389806e+07 0.0 \n", "688368.SH 2018-12-31 2019-09-17 0.000000e+00 0.0 \n", "688396.SH 2018-12-31 2020-01-31 0.000000e+00 0.0 \n", "831010.NE 2018-12-31 2020-07-01 4.129632e+07 0.0 \n", "833874.NE 2018-12-31 2020-06-29 9.051358e+07 0.0 \n", "\n", " CREDIT_IMPAIRMENT_LOSS RD_EXPENSE \\\n", "code report_period appear_at_date \n", "000400.SZ 2018-12-31 2019-03-29 0.0 3.350267e+08 \n", "000558.SZ 2018-12-31 2019-04-26 0.0 0.000000e+00 \n", "000677.SZ 2018-12-31 2019-03-29 0.0 3.514984e+05 \n", "000731.SZ 2018-12-31 2019-04-16 0.0 1.653546e+06 \n", "000752.SZ 2018-12-31 2019-05-16 0.0 0.000000e+00 \n", "... ... ... \n", "688039.SH 2018-12-31 2019-11-22 0.0 3.660990e+07 \n", "688368.SH 2018-12-31 2019-09-17 0.0 6.081719e+07 \n", "688396.SH 2018-12-31 2020-01-31 0.0 4.497610e+08 \n", "831010.NE 2018-12-31 2020-07-01 0.0 5.236440e+05 \n", "833874.NE 2018-12-31 2020-06-29 0.0 1.092805e+07 \n", "\n", " STMNOTE_FINEXP FIN_EXP_INT_INC \\\n", "code report_period appear_at_date \n", "000400.SZ 2018-12-31 2019-03-29 45075829.77 0.0 \n", "000558.SZ 2018-12-31 2019-04-26 39309311.59 0.0 \n", "000677.SZ 2018-12-31 2019-03-29 5234360.37 0.0 \n", "000731.SZ 2018-12-31 2019-04-16 46581902.65 0.0 \n", "000752.SZ 2018-12-31 2019-05-16 0.00 0.0 \n", "... ... ... \n", "688039.SH 2018-12-31 2019-11-22 0.00 0.0 \n", "688368.SH 2018-12-31 2019-09-17 0.00 0.0 \n", "688396.SH 2018-12-31 2020-01-31 0.00 0.0 \n", "831010.NE 2018-12-31 2020-07-01 254556.29 0.0 \n", "833874.NE 2018-12-31 2020-06-29 0.00 0.0 \n", "\n", " TOT_OPER_COST2 \n", "code report_period appear_at_date \n", "000400.SZ 2018-12-31 2019-03-29 7.967406e+09 \n", "000558.SZ 2018-12-31 2019-04-26 6.444387e+08 \n", "000677.SZ 2018-12-31 2019-03-29 6.821367e+08 \n", "000731.SZ 2018-12-31 2019-04-16 2.367904e+09 \n", "000752.SZ 2018-12-31 2019-05-16 3.135966e+08 \n", "... ... \n", "688039.SH 2018-12-31 2019-11-22 1.511902e+08 \n", "688368.SH 2018-12-31 2019-09-17 6.890894e+08 \n", "688396.SH 2018-12-31 2020-01-31 5.796301e+09 \n", "831010.NE 2018-12-31 2020-07-01 2.437095e+08 \n", "833874.NE 2018-12-31 2020-06-29 1.021658e+08 \n", "\n", "[91 rows x 66 columns]" ] }, "execution_count": 44, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#sess.run(\"\"\"\n", "# is_common_ori = loadTable(\"dfs://pit_stock_ts\", \"is_common_ori\")\n", "#\"\"\")\n", "\n", "# pit_report_period_at_date(table_name, date, report_period_list, code_partition_id)\n", "sess.run(\"\"\"\n", " select * from pit_at_date(\"is_common_ori\", 2021.03.14, [2018.12.31], 0) order by code\n", "\"\"\").set_index(['code', 'report_period', 'appear_at_date'])" ] }, { "cell_type": "code", "execution_count": 70, "id": "4cd4cd6e-f34e-43a8-98de-c468a54d8081", "metadata": {}, "outputs": [], "source": [ "sess.run(\"\"\"\n", " dropFunctionView('pit_col_at_date');\n", "\"\"\")\n", "\n", "sess.run(\"\"\"\n", "def pit_col_at_date(table_name, col_name, date, report_period_list, code_partition_id){\n", "\tsource_table = loadTable(\"dfs://pit_stock_ts\", table_name);\n", "\t\n", "\tm_nDate = take(date, size(report_period_list));\n", "\treport_period = report_period_list;\n", "\t\n", "\tquery_table = table(report_period, m_nDate);\n", "\tquery_table_exp = select * from cj(\n", " query_table, \n", " select code from source_table where partition(code, code_partition_id\n", " ) group by code map);\n", "\t\n", "\tcol_list = sqlCol(['code', 'report_period', 'appear_at_date', col_name]);\n", " from_tbl = ;\n", " where_conditions = [];\n", " source_table_part = sql(select=col_list, from=from_tbl, where=where_conditions).eval();\n", "\t\n", "\treturn select source_table_part.* from aj(query_table_exp, source_table_part, `code`report_period`m_nDate, `code`report_period`appear_at_date) where not isNull(source_table_part.code)\n", "}\n", "\n", "addFunctionView(pit_col_at_date);\n", "\"\"\")" ] }, { "cell_type": "code", "execution_count": 71, "id": "943b760a-ab39-4291-8a93-81b3e38a70b7", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
TOT_OPER_REV
codereport_periodappear_at_date
000400.SZ2019-09-302020-10-295.658881e+09
000558.SZ2019-09-302020-10-298.322244e+07
000677.SZ2019-09-302020-10-216.020088e+08
000731.SZ2019-09-302020-10-272.311672e+09
000752.SZ2019-09-302020-10-292.330136e+08
............
688039.SH2019-09-302020-10-281.185143e+08
688368.SH2019-09-302020-10-286.139719e+08
688396.SH2019-09-302020-10-204.131915e+09
831010.NE2019-09-302020-10-292.276040e+08
833874.NE2019-09-302020-10-261.303494e+08
\n", "

91 rows × 1 columns

\n", "
" ], "text/plain": [ " TOT_OPER_REV\n", "code report_period appear_at_date \n", "000400.SZ 2019-09-30 2020-10-29 5.658881e+09\n", "000558.SZ 2019-09-30 2020-10-29 8.322244e+07\n", "000677.SZ 2019-09-30 2020-10-21 6.020088e+08\n", "000731.SZ 2019-09-30 2020-10-27 2.311672e+09\n", "000752.SZ 2019-09-30 2020-10-29 2.330136e+08\n", "... ...\n", "688039.SH 2019-09-30 2020-10-28 1.185143e+08\n", "688368.SH 2019-09-30 2020-10-28 6.139719e+08\n", "688396.SH 2019-09-30 2020-10-20 4.131915e+09\n", "831010.NE 2019-09-30 2020-10-29 2.276040e+08\n", "833874.NE 2019-09-30 2020-10-26 1.303494e+08\n", "\n", "[91 rows x 1 columns]" ] }, "execution_count": 71, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sess.run(\"\"\"\n", " select * from pit_col_at_date(\"is_common_adj\", \"TOT_OPER_REV\", 2021.03.14, [2019.09.30], 0) order by code\n", "\"\"\").set_index(['code', 'report_period', 'appear_at_date'])" ] }, { "cell_type": "code", "execution_count": 59, "id": "2fea0f1e-5105-4d28-9c36-c5542a5389ba", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
codereport_periodappear_in_periodappear_at_dateTOT_OPER_REV
0000400.SZ2019-12-312019-12-312020-04-101.015608e+10
1000558.SZ2019-12-312019-12-312020-04-271.378479e+08
2000558.SZ2019-12-312019-12-312020-08-251.378479e+08
3000677.SZ2019-12-312019-12-312020-04-257.906742e+08
4000731.SZ2019-12-312019-12-312020-04-242.929131e+09
..................
109688396.SH2019-12-312019-12-312020-04-235.742784e+09
110831010.NE2019-12-312019-12-312020-04-133.552313e+08
111831010.NE2019-12-312019-12-312020-07-013.552313e+08
112833874.NE2019-12-312019-12-312020-03-181.785113e+08
113833874.NE2019-12-312019-12-312020-06-291.785113e+08
\n", "

114 rows × 5 columns

\n", "
" ], "text/plain": [ " code report_period appear_in_period appear_at_date TOT_OPER_REV\n", "0 000400.SZ 2019-12-31 2019-12-31 2020-04-10 1.015608e+10\n", "1 000558.SZ 2019-12-31 2019-12-31 2020-04-27 1.378479e+08\n", "2 000558.SZ 2019-12-31 2019-12-31 2020-08-25 1.378479e+08\n", "3 000677.SZ 2019-12-31 2019-12-31 2020-04-25 7.906742e+08\n", "4 000731.SZ 2019-12-31 2019-12-31 2020-04-24 2.929131e+09\n", ".. ... ... ... ... ...\n", "109 688396.SH 2019-12-31 2019-12-31 2020-04-23 5.742784e+09\n", "110 831010.NE 2019-12-31 2019-12-31 2020-04-13 3.552313e+08\n", "111 831010.NE 2019-12-31 2019-12-31 2020-07-01 3.552313e+08\n", "112 833874.NE 2019-12-31 2019-12-31 2020-03-18 1.785113e+08\n", "113 833874.NE 2019-12-31 2019-12-31 2020-06-29 1.785113e+08\n", "\n", "[114 rows x 5 columns]" ] }, "execution_count": 59, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sess.run(\"\"\"\n", " source_table = loadTable(\"dfs://pit_stock_ts\", \"is_common_ori\");\n", " m_nDate = [2022.03.04]\n", " report_period = [2019.12.31]\n", "\tquery_table = table(report_period, m_nDate);\n", "\tquery_table_exp = select * from cj(query_table, select code from source_table where partition(code, 0) group by code map);\n", "\t\n", " \n", " col_list = sqlCol(['code', 'report_period', 'appear_in_period', 'appear_at_date', 'TOT_OPER_REV']);\n", " from_tbl = ;\n", " where_conditions = [];\n", " source_table_part = sql(select=col_list, from=from_tbl, where=where_conditions).eval();\n", "\tsource_table_part\n", "\"\"\")" ] }, { "cell_type": "code", "execution_count": 181, "id": "3c246940-1ad6-414f-b461-2d8ca7cd87f1", "metadata": {}, "outputs": [], "source": [ "sess.run(\"\"\"\n", " def single_quarter(table_name, col_list) {\n", " \n", " sel_col = array(ANY, 4 + size(col_list));\n", " sel_col[0] = sqlCol('code');\n", " sel_col[2] = sqlColAlias(, 'year');\n", " \n", " for (i in 0..(size(col_list) - 1)) {\n", " sel_col[i + 4] = sqlCol(col_list[i]);\n", " }\n", "\n", " // 当季累计数据,作为下一季基准\n", " sel_col[1] = sqlColAlias(sqlCol('report_period'), 'base_report_period');\n", " sel_col[3] = sqlColAlias(, 'quarter_of_year');\n", " tbl_quarter_accum_base = sql(\n", " select = sel_col,\n", " from = table_name,\n", " where = \n", " ).eval();\n", "\n", " // 从第二季开始,需要去匹配前一季累计基数\n", " sel_col[1] = sqlColAlias(sqlCol('report_period'), 'current_report_period');\n", " sel_col[3] = sqlColAlias(, 'quarter_of_year');\n", " tbl_quarter_accum = sql(\n", " select = sel_col,\n", " from = table_name,\n", " where = 1>\n", " ).eval();\n", "\n", " // 单季流量,把非第一季的季报都要扣除前一季度的基数\n", " sel_col[1] = sqlColAlias(sqlCol('current_report_period'), 'report_period');\n", " sel_col[2] = sqlCol('year');\n", " sel_col[3] = sqlCol('quarter_of_year');\n", " for (i in 0..(size(col_list) - 1)) {\n", " sel_col[i + 4] = sqlColAlias(\n", " expr(\n", " sqlCol('tbl_quarter_accum_' + col_list[i]),\n", " -,\n", " sqlCol(col_list[i])\n", " )\n", " , col_list[i] + '_flux');\n", " }\n", " from_obj = ej(\n", " tbl_quarter_accum_base, \n", " tbl_quarter_accum, \n", " `code`year`quarter_of_year, \n", " `code`year`quarter_of_year);\n", " tbl_quarter_flux = sql(\n", " select = sel_col, \n", " from = from_obj\n", " ).eval();\n", "\n", " // 每年第一个季度\n", " sel_col[1] = sqlCol('report_period');\n", " sel_col[2] = sqlColAlias(, 'year');\n", " sel_col[3] = sqlColAlias(, 'quarter_of_year');\n", " for (i in 0..(size(col_list) - 1)) {\n", " sel_col[i + 4] = sqlColAlias(sqlCol(col_list[i]), col_list[i] + '_flux');\n", " }\n", " tbl_quarter1 = sql(\n", " select = sel_col,\n", " from = table_name,\n", " where = \n", " ).eval();\n", " \n", " // 再拼接回第一季度(无需扣除基数的数据)\n", " tbl_quarter_flux = unionAll(\n", " tbl_quarter1, \n", " tbl_quarter_flux\n", " );\n", " \n", " return tbl_quarter_flux;\n", " }\n", "\"\"\")" ] }, { "cell_type": "code", "execution_count": 182, "id": "981c8b85-a750-4d6b-bed9-c2567a95b2a3", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
codereport_periodyearquarter_of_yearTOT_OPER_REV_flux
0000400.SZ2019-03-31201911.032565e+09
82000400.SZ2019-06-30201922.021923e+09
81000400.SZ2019-09-30201932.183729e+09
80000400.SZ2019-12-31201944.917866e+09
1000558.SZ2019-03-31201912.361816e+07
..................
321688396.SH2019-12-31201941.610869e+09
79833874.NE2019-03-31201913.720237e+07
325833874.NE2019-06-30201924.538674e+07
324833874.NE2019-09-30201934.776034e+07
323833874.NE2019-12-31201944.816188e+07
\n", "

326 rows × 5 columns

\n", "
" ], "text/plain": [ " code report_period year quarter_of_year TOT_OPER_REV_flux\n", "0 000400.SZ 2019-03-31 2019 1 1.032565e+09\n", "82 000400.SZ 2019-06-30 2019 2 2.021923e+09\n", "81 000400.SZ 2019-09-30 2019 3 2.183729e+09\n", "80 000400.SZ 2019-12-31 2019 4 4.917866e+09\n", "1 000558.SZ 2019-03-31 2019 1 2.361816e+07\n", ".. ... ... ... ... ...\n", "321 688396.SH 2019-12-31 2019 4 1.610869e+09\n", "79 833874.NE 2019-03-31 2019 1 3.720237e+07\n", "325 833874.NE 2019-06-30 2019 2 4.538674e+07\n", "324 833874.NE 2019-09-30 2019 3 4.776034e+07\n", "323 833874.NE 2019-12-31 2019 4 4.816188e+07\n", "\n", "[326 rows x 5 columns]" ] }, "execution_count": 182, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sess.run(\"single_quarter(tmp_table, ['TOT_OPER_REV'])\").sort_values(['code', 'report_period'])" ] }, { "cell_type": "code", "execution_count": 144, "id": "1ceea0a7-7218-4aa7-be8a-ebb655dcbc93", "metadata": {}, "outputs": [], "source": [ "sess.run(\"\"\"\n", " tmp_table = select * from pit_col_at_date(\n", " \"is_common_ori\", \n", " \"TOT_OPER_REV\", \n", " 2021.03.14, \n", " [2019.12.31, 2019.09.30, 2019.06.30, 2019.03.31], \n", " 0) order by code\n", "\"\"\")" ] }, { "cell_type": "code", "execution_count": 145, "id": "d01d6fc2-15ed-4e40-9181-0f3e3a96d2cb", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
codereport_periodappear_at_dateTOT_OPER_REV
0000400.SZ2019-12-312020-04-101.015608e+10
1000400.SZ2019-09-302019-10-125.238217e+09
2000400.SZ2019-06-302019-08-243.054488e+09
3000400.SZ2019-03-312019-04-261.032565e+09
4000558.SZ2019-12-312020-08-251.378479e+08
...............
333831010.NE2019-06-302019-08-091.970813e+08
334833874.NE2019-12-312020-06-291.785113e+08
335833874.NE2019-09-302019-10-221.303494e+08
336833874.NE2019-06-302019-08-168.258911e+07
337833874.NE2019-03-312019-04-303.720237e+07
\n", "

338 rows × 4 columns

\n", "
" ], "text/plain": [ " code report_period appear_at_date TOT_OPER_REV\n", "0 000400.SZ 2019-12-31 2020-04-10 1.015608e+10\n", "1 000400.SZ 2019-09-30 2019-10-12 5.238217e+09\n", "2 000400.SZ 2019-06-30 2019-08-24 3.054488e+09\n", "3 000400.SZ 2019-03-31 2019-04-26 1.032565e+09\n", "4 000558.SZ 2019-12-31 2020-08-25 1.378479e+08\n", ".. ... ... ... ...\n", "333 831010.NE 2019-06-30 2019-08-09 1.970813e+08\n", "334 833874.NE 2019-12-31 2020-06-29 1.785113e+08\n", "335 833874.NE 2019-09-30 2019-10-22 1.303494e+08\n", "336 833874.NE 2019-06-30 2019-08-16 8.258911e+07\n", "337 833874.NE 2019-03-31 2019-04-30 3.720237e+07\n", "\n", "[338 rows x 4 columns]" ] }, "execution_count": 145, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sess.run(\"tmp_table\")" ] }, { "cell_type": "code", "execution_count": 50, "id": "5ac22809-9ba9-4a01-b76a-591558c4cc52", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'< select symbol,date,cumsum(volume) as cumVol from tmp_tablef0e858a3837f0000 >'" ] }, "execution_count": 50, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sess.run(\"\"\"\n", "sql(select=sqlCol(['symbol', 'date', 'cumsum(volume) as cumVol']), from = tmp_table)\n", "\"\"\")" ] }, { "cell_type": "code", "execution_count": 51, "id": "dc36ca56-07e0-4912-b5d2-da192a1c3c62", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'< select symbol,date,cumsum(volume) as cumVol from tmp_tablef0e858a3837f0000 >'" ] }, "execution_count": 51, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sess.run(\"\"\"\n", "sql(select=(sqlCol(`symbol),sqlCol(`date),sqlColAlias(, `cumVol)), from=tmp_table)\n", "\"\"\")" ] }, { "cell_type": "code", "execution_count": 211, "id": "c3be05b5-c9b9-4df5-8481-b3092c25125e", "metadata": {}, "outputs": [], "source": [ "sess.run(\"\"\"\n", " def yoy(table_name, col_list) {\n", " sel_col = array(ANY, 4 + size(col_list));\n", " sel_col[0] = sqlCol('code');\n", " sel_col[3] = sqlColAlias(, 'quarter_of_year');\n", " \n", " // 上一年数据\n", " for (i in 0..(size(col_list) - 1)) {\n", " sel_col[i + 4] = sqlColAlias(sqlCol(col_list[i]), col_list[i] + '_base');\n", " }\n", " sel_col[1] = sqlColAlias(sqlCol('report_period'), 'report_period_last_year');\n", " sel_col[2] = sqlColAlias(, 'year');\n", " tbl_last_year = sql(\n", " select = sel_col,\n", " from = table_name\n", " ).eval();\n", "\n", " // 本年度数据\n", " for (i in 0..(size(col_list) - 1)) {\n", " sel_col[i + 4] = sqlCol(col_list[i]);\n", " }\n", " sel_col[1] = sqlColAlias(sqlCol('report_period'), 'report_period_current_year');\n", " sel_col[2] = sqlColAlias(, 'year');\n", " tbl_this_year = sql(\n", " select = sel_col,\n", " from = table_name\n", " ).eval();\n", " \n", " // 计算同比增长率\n", " sel_col = array(ANY, 4 + (3 * size(col_list)));\n", "\n", " sel_col[0] = sqlCol('code');\n", " sel_col[1] = sqlColAlias(sqlCol('report_period_current_year'), 'report_period');\n", " sel_col[2] = sqlCol('year');\n", " sel_col[3] = sqlCol('quarter_of_year');\n", " \n", " for (i in 0..(size(col_list) - 1)) {\n", " sel_col[3 * i + 4] = sqlCol(col_list[i] + '_base');\n", " sel_col[3 * i + 5] = sqlCol(col_list[i]);\n", " sel_col[3 * i + 6] = sqlColAlias(\n", " expr(expr(sqlCol(col_list[i]), -, sqlCol(col_list[i] + '_base')), /, expr(abs, sqlCol(col_list[i] + '_base'))), \n", " col_list[i] + '_yoy');\n", " }\n", " from_obj = ej(\n", " tbl_last_year, \n", " tbl_this_year, \n", " `code`year`quarter_of_year, \n", " `code`year`quarter_of_year);\n", " \n", " return sql(\n", " select = sel_col,\n", " from = from_obj).eval();\n", " }\n", "\"\"\")" ] }, { "cell_type": "code", "execution_count": 212, "id": "63492d0c-c348-4e8b-a08b-5feb279cee5e", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
codereport_periodyearquarter_of_yearTOT_OPER_REV_baseTOT_OPER_REVTOT_OPER_REV_yoy
0000400.SZ2019-12-31201948.216559e+091.015608e+100.236051
1000400.SZ2018-12-31201841.033072e+108.216559e+09-0.204648
2000558.SZ2019-12-31201947.024741e+081.378479e+08-0.803768
3000558.SZ2018-12-31201841.324249e+097.024741e+08-0.469530
4000677.SZ2019-12-31201947.068198e+087.906742e+080.118636
........................
177688396.SH2018-12-31201845.875590e+096.270797e+090.067262
178831010.NE2019-12-31201942.936331e+083.552313e+080.209780
179831010.NE2018-12-31201842.209252e+082.936331e+080.329106
180833874.NE2019-12-31201941.974978e+081.785113e+08-0.096135
181833874.NE2018-12-31201841.986075e+081.974978e+08-0.005588
\n", "

182 rows × 7 columns

\n", "
" ], "text/plain": [ " code report_period year quarter_of_year TOT_OPER_REV_base \\\n", "0 000400.SZ 2019-12-31 2019 4 8.216559e+09 \n", "1 000400.SZ 2018-12-31 2018 4 1.033072e+10 \n", "2 000558.SZ 2019-12-31 2019 4 7.024741e+08 \n", "3 000558.SZ 2018-12-31 2018 4 1.324249e+09 \n", "4 000677.SZ 2019-12-31 2019 4 7.068198e+08 \n", ".. ... ... ... ... ... \n", "177 688396.SH 2018-12-31 2018 4 5.875590e+09 \n", "178 831010.NE 2019-12-31 2019 4 2.936331e+08 \n", "179 831010.NE 2018-12-31 2018 4 2.209252e+08 \n", "180 833874.NE 2019-12-31 2019 4 1.974978e+08 \n", "181 833874.NE 2018-12-31 2018 4 1.986075e+08 \n", "\n", " TOT_OPER_REV TOT_OPER_REV_yoy \n", "0 1.015608e+10 0.236051 \n", "1 8.216559e+09 -0.204648 \n", "2 1.378479e+08 -0.803768 \n", "3 7.024741e+08 -0.469530 \n", "4 7.906742e+08 0.118636 \n", ".. ... ... \n", "177 6.270797e+09 0.067262 \n", "178 3.552313e+08 0.209780 \n", "179 2.936331e+08 0.329106 \n", "180 1.785113e+08 -0.096135 \n", "181 1.974978e+08 -0.005588 \n", "\n", "[182 rows x 7 columns]" ] }, "execution_count": 212, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sess.run(\"yoy(tmp_table, ['TOT_OPER_REV'])\")" ] }, { "cell_type": "code", "execution_count": 183, "id": "5273ebfc-25bd-4b38-9605-d3109cf2280f", "metadata": {}, "outputs": [], "source": [ "sess.run(\"\"\"\n", " tmp_table = select * from pit_col_at_date(\n", " \"is_common_ori\", \n", " \"TOT_OPER_REV\", \n", " 2021.03.14, \n", " [2019.12.31, 2018.12.31, 2017.12.31], \n", " 0) order by code\n", "\"\"\")" ] }, { "cell_type": "code", "execution_count": 184, "id": "99af13cd-5918-4d21-9067-d3da86d19c15", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
codereport_periodappear_at_dateTOT_OPER_REV
0000400.SZ2019-12-312020-04-101.015608e+10
1000400.SZ2018-12-312019-03-298.216559e+09
2000400.SZ2017-12-312018-03-241.033072e+10
3000558.SZ2019-12-312020-08-251.378479e+08
4000558.SZ2018-12-312019-04-267.024741e+08
...............
268831010.NE2018-12-312020-07-012.936331e+08
269831010.NE2017-12-312020-07-012.209252e+08
270833874.NE2019-12-312020-06-291.785113e+08
271833874.NE2018-12-312020-06-291.974978e+08
272833874.NE2017-12-312020-06-291.986075e+08
\n", "

273 rows × 4 columns

\n", "
" ], "text/plain": [ " code report_period appear_at_date TOT_OPER_REV\n", "0 000400.SZ 2019-12-31 2020-04-10 1.015608e+10\n", "1 000400.SZ 2018-12-31 2019-03-29 8.216559e+09\n", "2 000400.SZ 2017-12-31 2018-03-24 1.033072e+10\n", "3 000558.SZ 2019-12-31 2020-08-25 1.378479e+08\n", "4 000558.SZ 2018-12-31 2019-04-26 7.024741e+08\n", ".. ... ... ... ...\n", "268 831010.NE 2018-12-31 2020-07-01 2.936331e+08\n", "269 831010.NE 2017-12-31 2020-07-01 2.209252e+08\n", "270 833874.NE 2019-12-31 2020-06-29 1.785113e+08\n", "271 833874.NE 2018-12-31 2020-06-29 1.974978e+08\n", "272 833874.NE 2017-12-31 2020-06-29 1.986075e+08\n", "\n", "[273 rows x 4 columns]" ] }, "execution_count": 184, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sess.run(\"tmp_table\")" ] }, { "cell_type": "code", "execution_count": null, "id": "87820a2a-1ddf-4950-b0d4-a3e7d4a61b16", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.13" } }, "nbformat": 4, "nbformat_minor": 5 }