From 0f13ce8e3a3cb016791a6ddf7077a014ff58a81d Mon Sep 17 00:00:00 2001 From: flashlan Date: Fri, 9 Jun 2023 15:53:52 -0300 Subject: [PATCH] finish Kdb+ --- compareDBs.ipynb | 579 ++++++++++++++++------------------------------- 1 file changed, 191 insertions(+), 388 deletions(-) diff --git a/compareDBs.ipynb b/compareDBs.ipynb index 4f0ba45..5ab1d11 100644 --- a/compareDBs.ipynb +++ b/compareDBs.ipynb @@ -47,7 +47,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 68, "id": "ab6c6c81-6ac1-4668-a79b-a9a0341fb35a", "metadata": { "tags": [] @@ -59,7 +59,7 @@ "False" ] }, - "execution_count": 18, + "execution_count": 68, "metadata": {}, "output_type": "execute_result" } @@ -85,7 +85,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "55c3cd57-0996-4723-beb5-8f3196c96009", "metadata": { "tags": [] @@ -98,7 +98,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "968403e3-2e5e-4834-b969-be4600e2963a", "metadata": { "tags": [] @@ -170,7 +170,6 @@ "cell_type": "markdown", "id": "274cc026-2f48-4e38-b80f-b1a9ff982060", "metadata": { - "jp-MarkdownHeadingCollapsed": true, "tags": [] }, "source": [ @@ -195,7 +194,6 @@ "cell_type": "markdown", "id": "4a8d5703-9bc9-4d38-83ff-457159304d58", "metadata": { - "jp-MarkdownHeadingCollapsed": true, "tags": [] }, "source": [ @@ -281,7 +279,6 @@ "cell_type": "markdown", "id": "1d389546-911f-43f7-aad1-49f7bcc83503", "metadata": { - "jp-MarkdownHeadingCollapsed": true, "tags": [] }, "source": [ @@ -374,7 +371,6 @@ "cell_type": "markdown", "id": "b9ddfdc6-c899-4f6c-9b4e-8ec6ab6d7e05", "metadata": { - "jp-MarkdownHeadingCollapsed": true, "tags": [] }, "source": [ @@ -445,7 +441,6 @@ "cell_type": "markdown", "id": "f9e0393d-7d1d-406a-a068-9dbf4968e977", "metadata": { - "jp-MarkdownHeadingCollapsed": true, "tags": [] }, "source": [ @@ -526,7 +521,6 @@ "cell_type": "markdown", "id": "50d1fc58-89a7-4507-aff0-6e943656cfe0", "metadata": { - "jp-MarkdownHeadingCollapsed": true, "tags": [] }, "source": [ @@ -535,7 +529,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "d104d9af-fa34-4261-8478-329a28ee4f2e", "metadata": { "tags": [] @@ -548,7 +542,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": null, "id": "0af8f72c-5b58-4dfc-af36-c5b4bc79f127", "metadata": { "tags": [] @@ -567,7 +561,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": null, "id": "f1b20d15-f5af-463c-813f-ffae61119de1", "metadata": { "tags": [] @@ -582,31 +576,12 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": null, "id": "70674d23-f375-4659-87ec-c745dec96d54", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "CPU times: user 19.2 s, sys: 269 ms, total: 19.5 s\n", - "Wall time: 50.1 s\n" - ] - }, - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 38, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "%%time\n", "# Insert collection\n", @@ -629,7 +604,6 @@ "cell_type": "markdown", "id": "97405e42-61dc-42c7-8220-237a312c0ec7", "metadata": { - "jp-MarkdownHeadingCollapsed": true, "tags": [] }, "source": [ @@ -638,18 +612,10 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": null, "id": "bbcdb883-d6dc-46db-88db-4c90b84522ba", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[(42,)]\n" - ] - } - ], + "outputs": [], "source": [ "cursor = duckdb.connect()\n", "print(cursor.execute(\"SELECT 42\").fetchall())" @@ -657,31 +623,12 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": null, "id": "35025a6e-9dc7-46cf-a792-76b3d84f1ac0", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "CPU times: user 1.53 s, sys: 63.6 ms, total: 1.59 s\n", - "Wall time: 1.59 s\n" - ] - }, - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 45, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "%%time\n", "conn = duckdb.connect()\n", @@ -691,280 +638,24 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": null, "id": "c6abdaaa-3ac2-425b-9208-d6cb79afe966", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
name
\n", - "
" - ], - "text/plain": [ - "Empty DataFrame\n", - "Columns: [name]\n", - "Index: []" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "display(conn.execute(\"SHOW TABLES\").df())" ] }, { "cell_type": "code", - "execution_count": 46, + "execution_count": null, "id": "2acce0f3-f0b2-47d0-8e0d-f9e9687efc18", "metadata": { "tags": [] }, - "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", - "
Unnamed: 0idfromattoopencloseminmaxvolume
0077308012023-01-02 15:58:4516726751400000000002023-01-02 15:59:001.0659951.0660351.0659301.06607057
1177308022023-01-02 15:59:0016726751550000000002023-01-02 15:59:151.0660551.0660851.0660051.06611552
2277308032023-01-02 15:59:1516726751700000000002023-01-02 15:59:301.0660801.0660251.0660251.06611057
3377308042023-01-02 15:59:3016726751850000000002023-01-02 15:59:451.0659801.0659851.0658851.06604564
4477308052023-01-02 15:59:4516726752000000000002023-01-02 16:00:001.0659751.0660551.0658301.06605550
.................................
99999599999579847482023-03-03 18:13:3016778672250000000002023-03-03 18:13:451.0626951.0626351.0626301.06270064
99999699999679847492023-03-03 18:13:4516778672400000000002023-03-03 18:14:001.0626451.0626501.0626251.06265043
99999799999779847502023-03-03 18:14:0016778672550000000002023-03-03 18:14:151.0626401.0626251.0626201.06266547
99999899999879847512023-03-03 18:14:1516778672700000000002023-03-03 18:14:301.0626251.0625351.0625351.06264543
99999999999979847522023-03-03 18:14:3016778672850000000002023-03-03 18:14:451.0625351.0625201.0625201.06258059
\n", - "

1000000 rows × 10 columns

\n", - "
" - ], - "text/plain": [ - " Unnamed: 0 id from at \n", - "0 0 7730801 2023-01-02 15:58:45 1672675140000000000 \\\n", - "1 1 7730802 2023-01-02 15:59:00 1672675155000000000 \n", - "2 2 7730803 2023-01-02 15:59:15 1672675170000000000 \n", - "3 3 7730804 2023-01-02 15:59:30 1672675185000000000 \n", - "4 4 7730805 2023-01-02 15:59:45 1672675200000000000 \n", - "... ... ... ... ... \n", - "999995 999995 7984748 2023-03-03 18:13:30 1677867225000000000 \n", - "999996 999996 7984749 2023-03-03 18:13:45 1677867240000000000 \n", - "999997 999997 7984750 2023-03-03 18:14:00 1677867255000000000 \n", - "999998 999998 7984751 2023-03-03 18:14:15 1677867270000000000 \n", - "999999 999999 7984752 2023-03-03 18:14:30 1677867285000000000 \n", - "\n", - " to open close min max volume \n", - "0 2023-01-02 15:59:00 1.065995 1.066035 1.065930 1.066070 57 \n", - "1 2023-01-02 15:59:15 1.066055 1.066085 1.066005 1.066115 52 \n", - "2 2023-01-02 15:59:30 1.066080 1.066025 1.066025 1.066110 57 \n", - "3 2023-01-02 15:59:45 1.065980 1.065985 1.065885 1.066045 64 \n", - "4 2023-01-02 16:00:00 1.065975 1.066055 1.065830 1.066055 50 \n", - "... ... ... ... ... ... ... \n", - "999995 2023-03-03 18:13:45 1.062695 1.062635 1.062630 1.062700 64 \n", - "999996 2023-03-03 18:14:00 1.062645 1.062650 1.062625 1.062650 43 \n", - "999997 2023-03-03 18:14:15 1.062640 1.062625 1.062620 1.062665 47 \n", - "999998 2023-03-03 18:14:30 1.062625 1.062535 1.062535 1.062645 43 \n", - "999999 2023-03-03 18:14:45 1.062535 1.062520 1.062520 1.062580 59 \n", - "\n", - "[1000000 rows x 10 columns]" - ] - }, - "execution_count": 46, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "%%time\n", "df = conn.execute(\"SELECT * FROM EURUSDtest\").df()\n", @@ -974,14 +665,16 @@ { "cell_type": "markdown", "id": "4409cc89-ed14-4313-ac89-65b826038533", - "metadata": {}, + "metadata": { + "tags": [] + }, "source": [ "### Kdb+" ] }, { "cell_type": "code", - "execution_count": 66, + "execution_count": 69, "id": "14f63810-1943-4e28-9bce-2148be6be02d", "metadata": {}, "outputs": [], @@ -994,7 +687,7 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 70, "id": "8ff6c090-7e02-435a-a179-f2aab81da972", "metadata": {}, "outputs": [], @@ -1005,7 +698,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 71, "id": "b4eb8ab9-81e8-4732-8cf7-51f0981d3d57", "metadata": { "tags": [] @@ -1019,7 +712,7 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 75, "id": "97cb6b5b-65a5-46a0-a4ee-e5c535a716ab", "metadata": {}, "outputs": [ @@ -1027,20 +720,20 @@ "name": "stdout", "output_type": "stream", "text": [ - "CPU times: user 837 ms, sys: 40 ms, total: 877 ms\n", - "Wall time: 1.16 s\n" + "CPU times: user 925 ms, sys: 40 ms, total: 965 ms\n", + "Wall time: 1.43 s\n" ] } ], "source": [ - "# send df to kd+ in memory bank\n", "%%time\n", + "# send df to kd+ in memory bank\n", "q.sendSync(\"{t::x}\", data)" ] }, { "cell_type": "code", - "execution_count": 52, + "execution_count": 76, "id": "c2ed2d51-bc8e-4207-892a-35fc55d43570", "metadata": {}, "outputs": [ @@ -1050,7 +743,7 @@ "b':/home/sandman/q/tab1'" ] }, - "execution_count": 52, + "execution_count": 76, "metadata": {}, "output_type": "execute_result" } @@ -1062,7 +755,7 @@ }, { "cell_type": "code", - "execution_count": 53, + "execution_count": 77, "id": "9c055a95-f73f-43a3-8fbd-61e42235117e", "metadata": { "tags": [] @@ -1072,8 +765,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "CPU times: user 1.78 ms, sys: 2 µs, total: 1.79 ms\n", - "Wall time: 329 ms\n" + "CPU times: user 1.94 ms, sys: 1 µs, total: 1.94 ms\n", + "Wall time: 426 ms\n" ] } ], @@ -1085,7 +778,7 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 78, "id": "9760de38-9f04-4322-bfff-c7ee12d5dee5", "metadata": { "tags": [] @@ -1097,7 +790,7 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": 79, "id": "c06c9222-c69d-4872-9d21-052281a013e2", "metadata": { "tags": [] @@ -1107,8 +800,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "CPU times: user 957 ms, sys: 87.9 ms, total: 1.05 s\n", - "Wall time: 1.13 s\n" + "CPU times: user 1.08 s, sys: 116 ms, total: 1.2 s\n", + "Wall time: 1.27 s\n" ] } ], @@ -1120,80 +813,180 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": 80, "id": "8815f01c-fd0a-4f94-ab7f-f8ede84ba4e7", "metadata": { "tags": [] }, - "outputs": [ - { - "ename": "TypeError", - "evalue": "'QTable' object is not callable", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[58], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mdf2\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mtype\u001b[39;49m\u001b[43m)\u001b[49m\n", - "\u001b[0;31mTypeError\u001b[0m: 'QTable' object is not callable" - ] - } - ], + "outputs": [], "source": [ "# df2(type)" ] }, { "cell_type": "code", - "execution_count": 67, + "execution_count": 82, "id": "e6ed3927-4395-45cd-9a28-88c5db01f2e5", "metadata": { "tags": [] }, "outputs": [ { - "ename": "AttributeError", - "evalue": "'bool' object has no attribute 'to_numpy'", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", - "File \u001b[0;32m:2\u001b[0m\n", - "File \u001b[0;32m~/dev/pipenv/lib/python3.10/site-packages/qpython/qconnection.py:385\u001b[0m, in \u001b[0;36mQConnection.__call__\u001b[0;34m(self, *parameters, **options)\u001b[0m\n\u001b[1;32m 384\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__call__\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39mparameters, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39moptions):\n\u001b[0;32m--> 385\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msendSync\u001b[49m\u001b[43m(\u001b[49m\u001b[43mparameters\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mparameters\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/dev/pipenv/lib/python3.10/site-packages/qpython/qconnection.py:303\u001b[0m, in \u001b[0;36mQConnection.sendSync\u001b[0;34m(self, query, *parameters, **options)\u001b[0m\n\u001b[1;32m 249\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m'''Performs a synchronous query against a q service and returns parsed \u001b[39;00m\n\u001b[1;32m 250\u001b[0m \u001b[38;5;124;03mdata.\u001b[39;00m\n\u001b[1;32m 251\u001b[0m \u001b[38;5;124;03m\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 300\u001b[0m \u001b[38;5;124;03m :class:`.QReaderException`\u001b[39;00m\n\u001b[1;32m 301\u001b[0m \u001b[38;5;124;03m'''\u001b[39;00m\n\u001b[1;32m 302\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mquery(MessageType\u001b[38;5;241m.\u001b[39mSYNC, query, \u001b[38;5;241m*\u001b[39mparameters, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39moptions)\n\u001b[0;32m--> 303\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mreceive\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdata_only\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 305\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m response\u001b[38;5;241m.\u001b[39mtype \u001b[38;5;241m==\u001b[39m MessageType\u001b[38;5;241m.\u001b[39mRESPONSE:\n\u001b[1;32m 306\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\u001b[38;5;241m.\u001b[39mdata\n", - "File \u001b[0;32m~/dev/pipenv/lib/python3.10/site-packages/qpython/qconnection.py:380\u001b[0m, in \u001b[0;36mQConnection.receive\u001b[0;34m(self, data_only, **options)\u001b[0m\n\u001b[1;32m 341\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mreceive\u001b[39m(\u001b[38;5;28mself\u001b[39m, data_only \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39moptions):\n\u001b[1;32m 342\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m'''Reads and (optionally) parses the response from a q service.\u001b[39;00m\n\u001b[1;32m 343\u001b[0m \u001b[38;5;124;03m \u001b[39;00m\n\u001b[1;32m 344\u001b[0m \u001b[38;5;124;03m Retrieves query result along with meta-information:\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 378\u001b[0m \u001b[38;5;124;03m :raises: :class:`.QReaderException`\u001b[39;00m\n\u001b[1;32m 379\u001b[0m \u001b[38;5;124;03m '''\u001b[39;00m\n\u001b[0;32m--> 380\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_reader\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_options\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43munion_dict\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 381\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m result\u001b[38;5;241m.\u001b[39mdata \u001b[38;5;28;01mif\u001b[39;00m data_only \u001b[38;5;28;01melse\u001b[39;00m result\n", - "File \u001b[0;32m~/dev/pipenv/lib/python3.10/site-packages/qpython/qreader.py:139\u001b[0m, in \u001b[0;36mQReader.read\u001b[0;34m(self, source, **options)\u001b[0m\n\u001b[1;32m 120\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m'''\u001b[39;00m\n\u001b[1;32m 121\u001b[0m \u001b[38;5;124;03mReads and optionally parses a single message.\u001b[39;00m\n\u001b[1;32m 122\u001b[0m \u001b[38;5;124;03m\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 136\u001b[0m \u001b[38;5;124;03m with meta information\u001b[39;00m\n\u001b[1;32m 137\u001b[0m \u001b[38;5;124;03m'''\u001b[39;00m\n\u001b[1;32m 138\u001b[0m message \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mread_header(source)\n\u001b[0;32m--> 139\u001b[0m message\u001b[38;5;241m.\u001b[39mdata \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread_data\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmessage\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msize\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmessage\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mis_compressed\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 141\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m message\n", - "File \u001b[0;32m~/dev/pipenv/lib/python3.10/site-packages/qpython/qreader.py:216\u001b[0m, in \u001b[0;36mQReader.read_data\u001b[0;34m(self, message_size, is_compressed, **options)\u001b[0m\n\u001b[1;32m 213\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_stream \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_options\u001b[38;5;241m.\u001b[39mraw:\n\u001b[1;32m 214\u001b[0m raw_data \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_buffer\u001b[38;5;241m.\u001b[39mraw(message_size \u001b[38;5;241m-\u001b[39m \u001b[38;5;241m8\u001b[39m)\n\u001b[0;32m--> 216\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m raw_data \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_options\u001b[38;5;241m.\u001b[39mraw \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_read_object\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/dev/pipenv/lib/python3.10/site-packages/qpython/qreader.py:225\u001b[0m, in \u001b[0;36mQReader._read_object\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 222\u001b[0m reader \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_get_reader(qtype)\n\u001b[1;32m 224\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m reader:\n\u001b[0;32m--> 225\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mreader\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mqtype\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 226\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m qtype \u001b[38;5;241m>\u001b[39m\u001b[38;5;241m=\u001b[39m QBOOL_LIST \u001b[38;5;129;01mand\u001b[39;00m qtype \u001b[38;5;241m<\u001b[39m\u001b[38;5;241m=\u001b[39m QTIME_LIST:\n\u001b[1;32m 227\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_read_list(qtype)\n", - "File \u001b[0;32m~/dev/pipenv/lib/python3.10/site-packages/qpython/_pandas.py:76\u001b[0m, in \u001b[0;36mPandasQReader._read_table\u001b[0;34m(self, qtype)\u001b[0m\n\u001b[1;32m 74\u001b[0m columns \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_read_object()\n\u001b[1;32m 75\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_buffer\u001b[38;5;241m.\u001b[39mskip() \u001b[38;5;66;03m# ignore generic list type indicator\u001b[39;00m\n\u001b[0;32m---> 76\u001b[0m data \u001b[38;5;241m=\u001b[39m \u001b[43mQReader\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_read_general_list\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mqtype\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 78\u001b[0m odict \u001b[38;5;241m=\u001b[39m OrderedDict()\n\u001b[1;32m 79\u001b[0m meta \u001b[38;5;241m=\u001b[39m MetaData(qtype \u001b[38;5;241m=\u001b[39m QTABLE)\n", - "File \u001b[0;32m~/dev/pipenv/lib/python3.10/site-packages/qpython/qreader.py:338\u001b[0m, in \u001b[0;36mQReader._read_general_list\u001b[0;34m(self, qtype)\u001b[0m\n\u001b[1;32m 335\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_buffer\u001b[38;5;241m.\u001b[39mskip() \u001b[38;5;66;03m# ignore attributes\u001b[39;00m\n\u001b[1;32m 336\u001b[0m length \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_buffer\u001b[38;5;241m.\u001b[39mget_int()\n\u001b[0;32m--> 338\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m [\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_read_object() \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(length)]\n", - "File \u001b[0;32m~/dev/pipenv/lib/python3.10/site-packages/qpython/qreader.py:338\u001b[0m, in \u001b[0;36m\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 335\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_buffer\u001b[38;5;241m.\u001b[39mskip() \u001b[38;5;66;03m# ignore attributes\u001b[39;00m\n\u001b[1;32m 336\u001b[0m length \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_buffer\u001b[38;5;241m.\u001b[39mget_int()\n\u001b[0;32m--> 338\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m [\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_read_object\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(length)]\n", - "File \u001b[0;32m~/dev/pipenv/lib/python3.10/site-packages/qpython/qreader.py:227\u001b[0m, in \u001b[0;36mQReader._read_object\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 225\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m reader(\u001b[38;5;28mself\u001b[39m, qtype)\n\u001b[1;32m 226\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m qtype \u001b[38;5;241m>\u001b[39m\u001b[38;5;241m=\u001b[39m QBOOL_LIST \u001b[38;5;129;01mand\u001b[39;00m qtype \u001b[38;5;241m<\u001b[39m\u001b[38;5;241m=\u001b[39m QTIME_LIST:\n\u001b[0;32m--> 227\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_read_list\u001b[49m\u001b[43m(\u001b[49m\u001b[43mqtype\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 228\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m qtype \u001b[38;5;241m<\u001b[39m\u001b[38;5;241m=\u001b[39m QBOOL \u001b[38;5;129;01mand\u001b[39;00m qtype \u001b[38;5;241m>\u001b[39m\u001b[38;5;241m=\u001b[39m QTIME:\n\u001b[1;32m 229\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_read_atom(qtype)\n", - "File \u001b[0;32m~/dev/pipenv/lib/python3.10/site-packages/qpython/_pandas.py:116\u001b[0m, in \u001b[0;36mPandasQReader._read_list\u001b[0;34m(self, qtype)\u001b[0m\n\u001b[1;32m 114\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;241m-\u001b[39m\u001b[38;5;28mabs\u001b[39m(qtype) \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m [QMONTH, QDATE, QDATETIME, QMINUTE, QSECOND, QTIME, QTIMESTAMP, QTIMESPAN, QSYMBOL]:\n\u001b[1;32m 115\u001b[0m null \u001b[38;5;241m=\u001b[39m QNULLMAP[\u001b[38;5;241m-\u001b[39m\u001b[38;5;28mabs\u001b[39m(qtype)][\u001b[38;5;241m1\u001b[39m]\n\u001b[0;32m--> 116\u001b[0m ps \u001b[38;5;241m=\u001b[39m \u001b[43mpandas\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mSeries\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdata\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mqlist\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mreplace\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnull\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnumpy\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mNaN\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 117\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 118\u001b[0m ps \u001b[38;5;241m=\u001b[39m pandas\u001b[38;5;241m.\u001b[39mSeries(data \u001b[38;5;241m=\u001b[39m qlist)\n", - "File \u001b[0;32m~/dev/pipenv/lib/python3.10/site-packages/pandas/core/series.py:5219\u001b[0m, in \u001b[0;36mSeries.replace\u001b[0;34m(self, to_replace, value, inplace, limit, regex, method)\u001b[0m\n\u001b[1;32m 5203\u001b[0m \u001b[38;5;129m@doc\u001b[39m(\n\u001b[1;32m 5204\u001b[0m NDFrame\u001b[38;5;241m.\u001b[39mreplace,\n\u001b[1;32m 5205\u001b[0m klass\u001b[38;5;241m=\u001b[39m_shared_doc_kwargs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mklass\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 5217\u001b[0m method: Literal[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpad\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mffill\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mbfill\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m|\u001b[39m lib\u001b[38;5;241m.\u001b[39mNoDefault \u001b[38;5;241m=\u001b[39m lib\u001b[38;5;241m.\u001b[39mno_default,\n\u001b[1;32m 5218\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Series \u001b[38;5;241m|\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m-> 5219\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mreplace\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 5220\u001b[0m \u001b[43m \u001b[49m\u001b[43mto_replace\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mto_replace\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 5221\u001b[0m \u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 5222\u001b[0m \u001b[43m \u001b[49m\u001b[43minplace\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minplace\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 5223\u001b[0m \u001b[43m \u001b[49m\u001b[43mlimit\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlimit\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 5224\u001b[0m \u001b[43m \u001b[49m\u001b[43mregex\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mregex\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 5225\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 5226\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/dev/pipenv/lib/python3.10/site-packages/pandas/core/generic.py:7389\u001b[0m, in \u001b[0;36mNDFrame.replace\u001b[0;34m(self, to_replace, value, inplace, limit, regex, method)\u001b[0m\n\u001b[1;32m 7383\u001b[0m new_data \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_mgr\u001b[38;5;241m.\u001b[39mreplace_regex(\n\u001b[1;32m 7384\u001b[0m to_replace\u001b[38;5;241m=\u001b[39mto_replace,\n\u001b[1;32m 7385\u001b[0m value\u001b[38;5;241m=\u001b[39mvalue,\n\u001b[1;32m 7386\u001b[0m inplace\u001b[38;5;241m=\u001b[39minplace,\n\u001b[1;32m 7387\u001b[0m )\n\u001b[1;32m 7388\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 7389\u001b[0m new_data \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_mgr\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mreplace\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 7390\u001b[0m \u001b[43m \u001b[49m\u001b[43mto_replace\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mto_replace\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43minplace\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minplace\u001b[49m\n\u001b[1;32m 7391\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 7392\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 7393\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\n\u001b[1;32m 7394\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mInvalid \u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mto_replace\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m type: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mrepr\u001b[39m(\u001b[38;5;28mtype\u001b[39m(to_replace)\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 7395\u001b[0m )\n", - "File \u001b[0;32m~/dev/pipenv/lib/python3.10/site-packages/pandas/core/internals/managers.py:475\u001b[0m, in \u001b[0;36mBaseBlockManager.replace\u001b[0;34m(self, to_replace, value, inplace)\u001b[0m\n\u001b[1;32m 473\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m is_list_like(to_replace)\n\u001b[1;32m 474\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m is_list_like(value)\n\u001b[0;32m--> 475\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mapply\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 476\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mreplace\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 477\u001b[0m \u001b[43m \u001b[49m\u001b[43mto_replace\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mto_replace\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 478\u001b[0m \u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 479\u001b[0m \u001b[43m \u001b[49m\u001b[43minplace\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minplace\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 480\u001b[0m \u001b[43m \u001b[49m\u001b[43musing_cow\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43musing_copy_on_write\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 481\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/dev/pipenv/lib/python3.10/site-packages/pandas/core/internals/managers.py:352\u001b[0m, in \u001b[0;36mBaseBlockManager.apply\u001b[0;34m(self, f, align_keys, **kwargs)\u001b[0m\n\u001b[1;32m 350\u001b[0m applied \u001b[38;5;241m=\u001b[39m b\u001b[38;5;241m.\u001b[39mapply(f, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[1;32m 351\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 352\u001b[0m applied \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mgetattr\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mb\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mf\u001b[49m\u001b[43m)\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 353\u001b[0m result_blocks \u001b[38;5;241m=\u001b[39m extend_blocks(applied, result_blocks)\n\u001b[1;32m 355\u001b[0m out \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mtype\u001b[39m(\u001b[38;5;28mself\u001b[39m)\u001b[38;5;241m.\u001b[39mfrom_blocks(result_blocks, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39maxes)\n", - "File \u001b[0;32m~/dev/pipenv/lib/python3.10/site-packages/pandas/core/internals/blocks.py:593\u001b[0m, in \u001b[0;36mBlock.replace\u001b[0;34m(self, to_replace, value, inplace, mask, using_cow)\u001b[0m\n\u001b[1;32m 590\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m [\u001b[38;5;28mself\u001b[39m] \u001b[38;5;28;01mif\u001b[39;00m inplace \u001b[38;5;28;01melse\u001b[39;00m [\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcopy()]\n\u001b[1;32m 592\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m mask \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m--> 593\u001b[0m mask \u001b[38;5;241m=\u001b[39m \u001b[43mmissing\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmask_missing\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvalues\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mto_replace\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 594\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m mask\u001b[38;5;241m.\u001b[39many():\n\u001b[1;32m 595\u001b[0m \u001b[38;5;66;03m# Note: we get here with test_replace_extension_other incorrectly\u001b[39;00m\n\u001b[1;32m 596\u001b[0m \u001b[38;5;66;03m# bc _can_hold_element is incorrect.\u001b[39;00m\n\u001b[1;32m 597\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m using_cow:\n", - "File \u001b[0;32m~/dev/pipenv/lib/python3.10/site-packages/pandas/core/missing.py:112\u001b[0m, in \u001b[0;36mmask_missing\u001b[0;34m(arr, values_to_mask)\u001b[0m\n\u001b[1;32m 108\u001b[0m new_mask \u001b[38;5;241m=\u001b[39m arr \u001b[38;5;241m==\u001b[39m x\n\u001b[1;32m 110\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(new_mask, np\u001b[38;5;241m.\u001b[39mndarray):\n\u001b[1;32m 111\u001b[0m \u001b[38;5;66;03m# usually BooleanArray\u001b[39;00m\n\u001b[0;32m--> 112\u001b[0m new_mask \u001b[38;5;241m=\u001b[39m \u001b[43mnew_mask\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mto_numpy\u001b[49m(dtype\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mbool\u001b[39m, na_value\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\n\u001b[1;32m 113\u001b[0m mask \u001b[38;5;241m|\u001b[39m\u001b[38;5;241m=\u001b[39m new_mask\n\u001b[1;32m 115\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m na_mask\u001b[38;5;241m.\u001b[39many():\n", - "\u001b[0;31mAttributeError\u001b[0m: 'bool' object has no attribute 'to_numpy'" + "name": "stdout", + "output_type": "stream", + "text": [ + "CPU times: user 1.25 s, sys: 132 ms, total: 1.39 s\n", + "Wall time: 1.46 s\n" ] + }, + { + "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", + "
Unnamed: 0idfromattoopencloseminmaxvolume
007730801b'2023-01-02 15:58:45'1672675140000000000b'2023-01-02 15:59:00'1.0659951.0660351.0659301.06607057
117730802b'2023-01-02 15:59:00'1672675155000000000b'2023-01-02 15:59:15'1.0660551.0660851.0660051.06611552
227730803b'2023-01-02 15:59:15'1672675170000000000b'2023-01-02 15:59:30'1.0660801.0660251.0660251.06611057
337730804b'2023-01-02 15:59:30'1672675185000000000b'2023-01-02 15:59:45'1.0659801.0659851.0658851.06604564
447730805b'2023-01-02 15:59:45'1672675200000000000b'2023-01-02 16:00:00'1.0659751.0660551.0658301.06605550
\n", + "
" + ], + "text/plain": [ + " Unnamed: 0 id from at \n", + "0 0 7730801 b'2023-01-02 15:58:45' 1672675140000000000 \\\n", + "1 1 7730802 b'2023-01-02 15:59:00' 1672675155000000000 \n", + "2 2 7730803 b'2023-01-02 15:59:15' 1672675170000000000 \n", + "3 3 7730804 b'2023-01-02 15:59:30' 1672675185000000000 \n", + "4 4 7730805 b'2023-01-02 15:59:45' 1672675200000000000 \n", + "\n", + " to open close min max volume \n", + "0 b'2023-01-02 15:59:00' 1.065995 1.066035 1.065930 1.066070 57 \n", + "1 b'2023-01-02 15:59:15' 1.066055 1.066085 1.066005 1.066115 52 \n", + "2 b'2023-01-02 15:59:30' 1.066080 1.066025 1.066025 1.066110 57 \n", + "3 b'2023-01-02 15:59:45' 1.065980 1.065985 1.065885 1.066045 64 \n", + "4 b'2023-01-02 16:00:00' 1.065975 1.066055 1.065830 1.066055 50 " + ] + }, + "execution_count": 82, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ "%%time\n", "# converto to dataframe\n", - "df = pd.DataFrame(q(\"t\", pandas=True))\n", + "df = pd.DataFrame(q(\"t\")) # , pandas=True))\n", "df.head()" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 83, "id": "0fc7f16b-6c39-4ebe-88d2-ff857e30ab62", "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "CPU times: user 1.11 s, sys: 116 ms, total: 1.23 s\n", + "Wall time: 1.3 s\n" + ] + } + ], "source": [ "%%time\n", "# select\n", @@ -1202,13 +995,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 84, "id": "c88646ca-3d25-4a85-80b5-f9e559f568dd", - "metadata": {}, + "metadata": { + "tags": [] + }, "outputs": [], "source": [ "q.close()" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "adf9720e-0692-462e-aa99-8b91b454b741", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": {