{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "2b46ea32-3e2e-466b-ac6a-9874336551af", "metadata": {}, "outputs": [], "source": [ "import dolphindb as ddb\n", "\n", "sess = ddb.session('localhost', 8848)\n", "sess.login('admin', '123456')" ] }, { "cell_type": "code", "execution_count": 6, "id": "6cc64a77-a5ad-46b6-8204-b188ee308ad3", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'partitionType': 5,\n", " 'partitionColumnType': 17,\n", " 'partitionColumnIndex': 0,\n", " 'chunkPath': None,\n", " 'colDefs': name typeString typeInt comment\n", " 0 code SYMBOL 17 \n", " 1 report_period DATE 6 \n", " 2 appear_at_date DATE 6 \n", " 3 S_PROFITNOTICE_STYLE STRING 18 \n", " 4 S_PROFITNOTICE_CHANGEMIN DOUBLE 16 \n", " 5 S_PROFITNOTICE_CHANGEMAX DOUBLE 16 \n", " 6 S_PROFITNOTICE_NETPROFITMIN DOUBLE 16 \n", " 7 S_PROFITNOTICE_NETPROFITMAX DOUBLE 16 \n", " 8 S_PROFITNOTICE_REASON STRING 18 ,\n", " 'chunkGranularity': 'TABLE',\n", " 'partitionTypeName': 'HASH',\n", " 'keepDuplicates': 'ALL',\n", " 'engineType': 'TSDB',\n", " 'partitionColumnName': 'code',\n", " 'partitionSchema': 50,\n", " 'sortColumns': array(['code', 'report_period', 'appear_at_date'], dtype=object),\n", " 'partitionSites': None}" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sess.run(\"tbl_ep = loadTable('dfs://pit_stock_ts', 'earnings_preannouncement')\")\n", "sess.run(\"schema(tbl_ep)\")" ] }, { "cell_type": "code", "execution_count": 10, "id": "39c05247-deac-4c49-a20d-e19e637c6081", "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", "
codereport_periodcnt
0600543.SH2021-12-313
1605499.SH2021-06-303
2603729.SH2020-12-313
3002058.SZ2020-12-313
4601599.SH2020-12-313
............
295600813.SH2002-06-304
296000689.SZ2002-06-305
297000653.SZ2002-06-304
298000658.SZ2002-06-307
299600853.SH2001-12-313
\n", "

300 rows × 3 columns

\n", "
" ], "text/plain": [ " code report_period cnt\n", "0 600543.SH 2021-12-31 3\n", "1 605499.SH 2021-06-30 3\n", "2 603729.SH 2020-12-31 3\n", "3 002058.SZ 2020-12-31 3\n", "4 601599.SH 2020-12-31 3\n", ".. ... ... ...\n", "295 600813.SH 2002-06-30 4\n", "296 000689.SZ 2002-06-30 5\n", "297 000653.SZ 2002-06-30 4\n", "298 000658.SZ 2002-06-30 7\n", "299 600853.SH 2001-12-31 3\n", "\n", "[300 rows x 3 columns]" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sess.run(\"\"\"\n", " select code, report_period, count(*) as cnt from tbl_ep group by code, report_period having count(*) > 2 order by report_period desc \n", "\"\"\")" ] }, { "cell_type": "code", "execution_count": 11, "id": "74623941-5f6e-48fc-b2a0-7050ae6c6045", "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", "
codereport_periodappear_at_dateS_PROFITNOTICE_STYLES_PROFITNOTICE_CHANGEMINS_PROFITNOTICE_CHANGEMAXS_PROFITNOTICE_NETPROFITMINS_PROFITNOTICE_NETPROFITMAXS_PROFITNOTICE_REASON
0600543.SH2021-12-312021-10-30预亏0.00.00.00.01-9月,公司累计营业收入增长39.61%,但较2019年同期仍有明显下滑,目前处于亏损状态...
1600543.SH2021-12-312022-01-29预亏-4939.0-4939.0-9000.0-9000.01、主营业务影响。受新冠肺炎疫情等因素影响,消费市场低迷,流通环节受限、下游需求收缩,公司葡...
2600543.SH2021-12-312022-03-31预亏-5408.0-5408.0-9872.0-9872.0公司财务部门将2021年度计提的固定资产减值准备4830万元,作非经常性损益处理,在审计时,...
\n", "
" ], "text/plain": [ " code report_period appear_at_date S_PROFITNOTICE_STYLE \\\n", "0 600543.SH 2021-12-31 2021-10-30 预亏 \n", "1 600543.SH 2021-12-31 2022-01-29 预亏 \n", "2 600543.SH 2021-12-31 2022-03-31 预亏 \n", "\n", " S_PROFITNOTICE_CHANGEMIN S_PROFITNOTICE_CHANGEMAX \\\n", "0 0.0 0.0 \n", "1 -4939.0 -4939.0 \n", "2 -5408.0 -5408.0 \n", "\n", " S_PROFITNOTICE_NETPROFITMIN S_PROFITNOTICE_NETPROFITMAX \\\n", "0 0.0 0.0 \n", "1 -9000.0 -9000.0 \n", "2 -9872.0 -9872.0 \n", "\n", " S_PROFITNOTICE_REASON \n", "0 1-9月,公司累计营业收入增长39.61%,但较2019年同期仍有明显下滑,目前处于亏损状态... \n", "1 1、主营业务影响。受新冠肺炎疫情等因素影响,消费市场低迷,流通环节受限、下游需求收缩,公司葡... \n", "2 公司财务部门将2021年度计提的固定资产减值准备4830万元,作非经常性损益处理,在审计时,... " ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sess.run(\"\"\"\n", "select * from tbl_ep where code='600543.SH' and report_period=2021.12.31\n", "\"\"\")" ] }, { "cell_type": "code", "execution_count": null, "id": "1425df79-bfaf-414a-9a12-f3d7e1231e5e", "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 }