{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "dd67dcdf", "metadata": {}, "outputs": [], "source": [ "import pygwalker as pyg\n", "import polars as pl\n", "df = pl.read_csv('./298040/day/candle-day-250.csv',try_parse_dates = True)\n", "gwalker = pyg.walk(df)\n" ] }, { "cell_type": "code", "execution_count": 2, "id": "f22b1844", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "shape: (14, 13)
stockBusinessDatestockClosingPricestockOpenningPricehighestStockPricelowestStockPriceaccumulatedVolumeaccumulatedTradingAmountexDivisionpartitionRatepartitionModifiablepreviousDayVariableRatioSignpreviousDayVariableRatiorevaluationIssueReason
i64i64i64i64i64i64i64i64f64stri64i64str
20230615912009120091200912000000.0"Y"00null
202306149120093000935008970091400835548380000.0"Y"5-1800null
202306139300094400961009250058177547492090000.0"Y"5-1400null
202306129440095100960009250090459852727580000.0"Y"5-1100null
20230609955009160095500916001533171446067470000.0"Y"24800null
20230608907009040093200899001115941022102030000.0"Y"2700null
20230607900008770091700866001307281172778440000.0"Y"22000null
202306058800088200889008700076802675297000000.0"Y"5-300null
20230602883008320088500827001977371717420050000.0"Y"26600null
202306018170079600824007950058524476462100000.0"Y"21700null
202305318000080100823007990072863591811960000.0"Y"5-600null
202305308060078700810007870042843343056890000.0"Y"21300null
202305267930081400821007910063816510028180000.0"Y"5-2200null
202305258150084000848008140068134564207340000.0"Y"5-2900null
" ], "text/plain": [ "shape: (14, 13)\n", "┌────────────┬────────────┬────────────┬────────────┬───┬────────────┬────────────┬────────────┬────────────┐\n", "│ stockBusin ┆ stockClosi ┆ stockOpenn ┆ highestSto ┆ … ┆ partitionM ┆ previousDa ┆ previousDa ┆ revaluatio │\n", "│ essDate ┆ ngPrice ┆ ingPrice ┆ ckPrice ┆ ┆ odifiable ┆ yVariableR ┆ yVariableR ┆ nIssueReas │\n", "│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ --- ┆ atioSign ┆ atio ┆ on │\n", "│ i64 ┆ i64 ┆ i64 ┆ i64 ┆ ┆ str ┆ --- ┆ --- ┆ --- │\n", "│ ┆ ┆ ┆ ┆ ┆ ┆ i64 ┆ i64 ┆ str │\n", "╞════════════╪════════════╪════════════╪════════════╪═══╪════════════╪════════════╪════════════╪════════════╡\n", "│ 20230615 ┆ 91200 ┆ 91200 ┆ 91200 ┆ … ┆ Y ┆ 0 ┆ 0 ┆ null │\n", "│ 20230614 ┆ 91200 ┆ 93000 ┆ 93500 ┆ … ┆ Y ┆ 5 ┆ -1800 ┆ null │\n", "│ 20230613 ┆ 93000 ┆ 94400 ┆ 96100 ┆ … ┆ Y ┆ 5 ┆ -1400 ┆ null │\n", "│ 20230612 ┆ 94400 ┆ 95100 ┆ 96000 ┆ … ┆ Y ┆ 5 ┆ -1100 ┆ null │\n", "│ … ┆ … ┆ … ┆ … ┆ … ┆ … ┆ … ┆ … ┆ … │\n", "│ 20230531 ┆ 80000 ┆ 80100 ┆ 82300 ┆ … ┆ Y ┆ 5 ┆ -600 ┆ null │\n", "│ 20230530 ┆ 80600 ┆ 78700 ┆ 81000 ┆ … ┆ Y ┆ 2 ┆ 1300 ┆ null │\n", "│ 20230526 ┆ 79300 ┆ 81400 ┆ 82100 ┆ … ┆ Y ┆ 5 ┆ -2200 ┆ null │\n", "│ 20230525 ┆ 81500 ┆ 84000 ┆ 84800 ┆ … ┆ Y ┆ 5 ┆ -2900 ┆ null │\n", "└────────────┴────────────┴────────────┴────────────┴───┴────────────┴────────────┴────────────┴────────────┘" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.sort(\"stockBusinessDate\", descending=True).limit(14)" ] }, { "cell_type": "code", "execution_count": 42, "id": "175e5213", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "shape: (1, 2)
updown
i64i64
17100-10300
" ], "text/plain": [ "shape: (1, 2)\n", "┌───────┬────────┐\n", "│ up ┆ down │\n", "│ --- ┆ --- │\n", "│ i64 ┆ i64 │\n", "╞═══════╪════════╡\n", "│ 17100 ┆ -10300 │\n", "└───────┴────────┘" ] }, "execution_count": 42, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\n", "def up(val: int) -> int:\n", " if val > 0 :\n", " return val\n", " else:\n", " return 0\n", "\n", "def down(val: int) -> int:\n", " if val < 0 :\n", " return val\n", " else: return 0\n", "\n", "#df.sort(\"stockBusinessDate\", descending=True).select([pl.col(\"previousDayVariableRatio\").apply(up).sum().alias(\"up\"), pl.col(\"previousDayVariableRatio\").apply(down).sum().alias(\"down\")]).limit(14)\n", "df.sort(\"stockBusinessDate\", descending=True).limit(14).select([pl.col(\"previousDayVariableRatio\").apply(up).sum().alias(\"up\"), pl.col(\"previousDayVariableRatio\").apply(down).sum().alias(\"down\")])" ] }, { "cell_type": "code", "execution_count": null, "id": "01cfce5c", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "bfaec855", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "dde44c3d", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "10cf7163", "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.11.3" } }, "nbformat": 4, "nbformat_minor": 5 }