{ "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", " | entity_id | \n", "
---|---|
code | \n", "\n", " |
000001.SZ | \n", "0 | \n", "
000002.SZ | \n", "1 | \n", "
000004.SZ | \n", "2 | \n", "
000005.SZ | \n", "3 | \n", "
000006.SZ | \n", "4 | \n", "
... | \n", "... | \n", "
871970.NE | \n", "5010 | \n", "
871981.NE | \n", "5011 | \n", "
872925.NE | \n", "5012 | \n", "
873169.NE | \n", "5013 | \n", "
873223.NE | \n", "5014 | \n", "
5015 rows × 1 columns
\n", "