{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "118641f9-96c3-4fd3-aea2-7ecdae17492e", "metadata": {}, "outputs": [], "source": [ "import dolphindb as ddb\n", "\n", "sess = ddb.session('localhost', 8848)\n", "sess.login('admin', '123456')" ] }, { "cell_type": "code", "execution_count": 4, "id": "44e3d35e-2e84-44fc-a3d2-00eaa0135460", "metadata": {}, "outputs": [], "source": [ "df = sess.run(\"\"\"\n", " select code from loadTable(\"dfs://daily_stock_ts\", \"daily_kline\")\n", " group by code order by code asc\n", "\"\"\")\n", "\n", "df[\"entity_id\"] = df.index\n", "df.set_index(\"code\", inplace=True)" ] }, { "cell_type": "code", "execution_count": 5, "id": "20a6066d-8efb-40fd-8a3b-3d848c8c0073", "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", "
entity_id
code
000001.SZ0
000002.SZ1
000004.SZ2
000005.SZ3
000006.SZ4
......
871970.NE5010
871981.NE5011
872925.NE5012
873169.NE5013
873223.NE5014
\n", "

5015 rows × 1 columns

\n", "
" ], "text/plain": [ " entity_id\n", "code \n", "000001.SZ 0\n", "000002.SZ 1\n", "000004.SZ 2\n", "000005.SZ 3\n", "000006.SZ 4\n", "... ...\n", "871970.NE 5010\n", "871981.NE 5011\n", "872925.NE 5012\n", "873169.NE 5013\n", "873223.NE 5014\n", "\n", "[5015 rows x 1 columns]" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df" ] }, { "cell_type": "code", "execution_count": null, "id": "cc934d77-3cc1-458f-9e28-3f0715e9b87b", "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 }