| { |
| "cells": [ |
| { |
| "cell_type": "code", |
| "execution_count": null, |
| "metadata": {}, |
| "outputs": [], |
| "source": [ |
| "# Execute this cell to install dependencies\n", |
| "%pip install sf-hamilton[visualization] polars" |
| ] |
| }, |
| { |
| "cell_type": "markdown", |
| "metadata": {}, |
| "source": [ |
| "# Polars materialization [](https://colab.research.google.com/github/dagworks-inc/hamilton/blob/main/examples/polars/notebook.ipynb) [](https://github.com/dagworks-inc/hamilton/blob/main/examples/polars/notebook.ipynb)\n" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 1, |
| "metadata": { |
| "ExecuteTime": { |
| "end_time": "2024-09-19T03:58:16.373994Z", |
| "start_time": "2024-09-19T03:58:16.369630Z" |
| }, |
| "collapsed": false, |
| "jupyter": { |
| "outputs_hidden": false |
| }, |
| "pycharm": { |
| "name": "#%%\n" |
| } |
| }, |
| "outputs": [ |
| { |
| "name": "stderr", |
| "output_type": "stream", |
| "text": [ |
| "/Users/jernejfrank/miniconda3/envs/hamilton/lib/python3.10/site-packages/pyspark/pandas/__init__.py:50: UserWarning: 'PYARROW_IGNORE_TIMEZONE' environment variable was not set. It is required to set this environment variable to '1' in both driver and executor sides if you use pyarrow>=2.0.0. pandas-on-Spark will set it for you but it does not work if there is a Spark context already launched.\n", |
| " warnings.warn(\n", |
| "/Users/jernejfrank/miniconda3/envs/hamilton/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", |
| " from .autonotebook import tqdm as notebook_tqdm\n" |
| ] |
| } |
| ], |
| "source": [ |
| "%load_ext hamilton.plugins.jupyter_magic" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 2, |
| "metadata": { |
| "ExecuteTime": { |
| "end_time": "2024-09-19T04:16:07.288070Z", |
| "start_time": "2024-09-19T04:16:06.626731Z" |
| }, |
| "collapsed": false, |
| "jupyter": { |
| "outputs_hidden": false |
| }, |
| "pycharm": { |
| "name": "#%%\n" |
| } |
| }, |
| "outputs": [ |
| { |
| "data": { |
| "image/svg+xml": [ |
| "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n", |
| "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n", |
| " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n", |
| "<!-- Generated by graphviz version 12.1.2 (20240928.0832)\n", |
| " -->\n", |
| "<!-- Pages: 1 -->\n", |
| "<svg width=\"985pt\" height=\"435pt\"\n", |
| " viewBox=\"0.00 0.00 985.10 434.80\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n", |
| "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 430.8)\">\n", |
| "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-430.8 981.1,-430.8 981.1,4 -4,4\"/>\n", |
| "<g id=\"clust1\" class=\"cluster\">\n", |
| "<title>cluster__legend</title>\n", |
| "<polygon fill=\"#ffffff\" stroke=\"black\" points=\"33.88,-288.8 33.88,-418.8 118.72,-418.8 118.72,-288.8 33.88,-288.8\"/>\n", |
| "<text text-anchor=\"middle\" x=\"76.3\" y=\"-401.5\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">Legend</text>\n", |
| "</g>\n", |
| "<!-- spend_zero_mean -->\n", |
| "<g id=\"node1\" class=\"node\">\n", |
| "<title>spend_zero_mean</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M701.5,-227.6C701.5,-227.6 585.4,-227.6 585.4,-227.6 579.4,-227.6 573.4,-221.6 573.4,-215.6 573.4,-215.6 573.4,-176 573.4,-176 573.4,-170 579.4,-164 585.4,-164 585.4,-164 701.5,-164 701.5,-164 707.5,-164 713.5,-170 713.5,-176 713.5,-176 713.5,-215.6 713.5,-215.6 713.5,-221.6 707.5,-227.6 701.5,-227.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"584.2\" y=\"-204.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_zero_mean</text>\n", |
| "<text text-anchor=\"start\" x=\"624.33\" y=\"-176.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n", |
| "</g>\n", |
| "<!-- spend_zero_mean_unit_variance -->\n", |
| "<g id=\"node4\" class=\"node\">\n", |
| "<title>spend_zero_mean_unit_variance</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M965.1,-145.6C965.1,-145.6 754.5,-145.6 754.5,-145.6 748.5,-145.6 742.5,-139.6 742.5,-133.6 742.5,-133.6 742.5,-94 742.5,-94 742.5,-88 748.5,-82 754.5,-82 754.5,-82 965.1,-82 965.1,-82 971.1,-82 977.1,-88 977.1,-94 977.1,-94 977.1,-133.6 977.1,-133.6 977.1,-139.6 971.1,-145.6 965.1,-145.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"753.3\" y=\"-122.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_zero_mean_unit_variance</text>\n", |
| "<text text-anchor=\"start\" x=\"840.67\" y=\"-94.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n", |
| "</g>\n", |
| "<!-- spend_zero_mean->spend_zero_mean_unit_variance -->\n", |
| "<g id=\"edge6\" class=\"edge\">\n", |
| "<title>spend_zero_mean->spend_zero_mean_unit_variance</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M713.75,-169.29C729.75,-163.17 747.05,-156.55 763.93,-150.09\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"764.87,-153.48 772.96,-146.64 762.37,-146.94 764.87,-153.48\"/>\n", |
| "</g>\n", |
| "<!-- spend_mean -->\n", |
| "<g id=\"node2\" class=\"node\">\n", |
| "<title>spend_mean</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M514.02,-227.6C514.02,-227.6 433.18,-227.6 433.18,-227.6 427.18,-227.6 421.18,-221.6 421.18,-215.6 421.18,-215.6 421.18,-176 421.18,-176 421.18,-170 427.18,-164 433.18,-164 433.18,-164 514.02,-164 514.02,-164 520.02,-164 526.02,-170 526.02,-176 526.02,-176 526.02,-215.6 526.02,-215.6 526.02,-221.6 520.02,-227.6 514.02,-227.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"431.98\" y=\"-204.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_mean</text>\n", |
| "<text text-anchor=\"start\" x=\"460.85\" y=\"-176.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n", |
| "</g>\n", |
| "<!-- spend_mean->spend_zero_mean -->\n", |
| "<g id=\"edge2\" class=\"edge\">\n", |
| "<title>spend_mean->spend_zero_mean</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M526.33,-195.8C537.5,-195.8 549.56,-195.8 561.55,-195.8\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"561.46,-199.3 571.46,-195.8 561.46,-192.3 561.46,-199.3\"/>\n", |
| "</g>\n", |
| "<!-- spend_per_signup -->\n", |
| "<g id=\"node3\" class=\"node\">\n", |
| "<title>spend_per_signup</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M532.4,-347.6C532.4,-347.6 414.8,-347.6 414.8,-347.6 408.8,-347.6 402.8,-341.6 402.8,-335.6 402.8,-335.6 402.8,-296 402.8,-296 402.8,-290 408.8,-284 414.8,-284 414.8,-284 532.4,-284 532.4,-284 538.4,-284 544.4,-290 544.4,-296 544.4,-296 544.4,-335.6 544.4,-335.6 544.4,-341.6 538.4,-347.6 532.4,-347.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"413.6\" y=\"-324.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_per_signup</text>\n", |
| "<text text-anchor=\"start\" x=\"454.48\" y=\"-296.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n", |
| "</g>\n", |
| "<!-- avg_3wk_spend -->\n", |
| "<g id=\"node5\" class=\"node\">\n", |
| "<title>avg_3wk_spend</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M524.52,-145.6C524.52,-145.6 422.68,-145.6 422.68,-145.6 416.68,-145.6 410.68,-139.6 410.68,-133.6 410.68,-133.6 410.68,-94 410.68,-94 410.68,-88 416.68,-82 422.68,-82 422.68,-82 524.52,-82 524.52,-82 530.52,-82 536.52,-88 536.52,-94 536.52,-94 536.52,-133.6 536.52,-133.6 536.52,-139.6 530.52,-145.6 524.52,-145.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"421.48\" y=\"-122.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">avg_3wk_spend</text>\n", |
| "<text text-anchor=\"start\" x=\"454.48\" y=\"-94.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n", |
| "</g>\n", |
| "<!-- base_df -->\n", |
| "<g id=\"node6\" class=\"node\">\n", |
| "<title>base_df</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M259.45,-287.6C259.45,-287.6 193.6,-287.6 193.6,-287.6 187.6,-287.6 181.6,-281.6 181.6,-275.6 181.6,-275.6 181.6,-236 181.6,-236 181.6,-230 187.6,-224 193.6,-224 193.6,-224 259.45,-224 259.45,-224 265.45,-224 271.45,-230 271.45,-236 271.45,-236 271.45,-275.6 271.45,-275.6 271.45,-281.6 265.45,-287.6 259.45,-287.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"201.02\" y=\"-264.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">base_df</text>\n", |
| "<text text-anchor=\"start\" x=\"192.4\" y=\"-236.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">DataFrame</text>\n", |
| "</g>\n", |
| "<!-- signups -->\n", |
| "<g id=\"node8\" class=\"node\">\n", |
| "<title>signups</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M361.8,-337.6C361.8,-337.6 312.45,-337.6 312.45,-337.6 306.45,-337.6 300.45,-331.6 300.45,-325.6 300.45,-325.6 300.45,-286 300.45,-286 300.45,-280 306.45,-274 312.45,-274 312.45,-274 361.8,-274 361.8,-274 367.8,-274 373.8,-280 373.8,-286 373.8,-286 373.8,-325.6 373.8,-325.6 373.8,-331.6 367.8,-337.6 361.8,-337.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"311.25\" y=\"-314.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">signups</text>\n", |
| "<text text-anchor=\"start\" x=\"318\" y=\"-286.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n", |
| "</g>\n", |
| "<!-- base_df->signups -->\n", |
| "<g id=\"edge11\" class=\"edge\">\n", |
| "<title>base_df->signups</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M271.7,-276.14C277.57,-278.84 283.61,-281.62 289.52,-284.34\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"288.04,-287.51 298.59,-288.52 290.97,-281.16 288.04,-287.51\"/>\n", |
| "</g>\n", |
| "<!-- spend -->\n", |
| "<g id=\"node9\" class=\"node\">\n", |
| "<title>spend</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M355.8,-246.6C355.8,-246.6 318.45,-246.6 318.45,-246.6 312.45,-246.6 306.45,-240.6 306.45,-234.6 306.45,-234.6 306.45,-195 306.45,-195 306.45,-189 312.45,-183 318.45,-183 318.45,-183 355.8,-183 355.8,-183 361.8,-183 367.8,-189 367.8,-195 367.8,-195 367.8,-234.6 367.8,-234.6 367.8,-240.6 361.8,-246.6 355.8,-246.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"317.25\" y=\"-223.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend</text>\n", |
| "<text text-anchor=\"start\" x=\"318\" y=\"-195.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n", |
| "</g>\n", |
| "<!-- base_df->spend -->\n", |
| "<g id=\"edge12\" class=\"edge\">\n", |
| "<title>base_df->spend</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M271.7,-239.12C279.6,-236.14 287.8,-233.04 295.59,-230.1\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"296.73,-233.41 304.85,-226.61 294.26,-226.86 296.73,-233.41\"/>\n", |
| "</g>\n", |
| "<!-- spend_std_dev -->\n", |
| "<g id=\"node7\" class=\"node\">\n", |
| "<title>spend_std_dev</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M521.52,-63.6C521.52,-63.6 425.68,-63.6 425.68,-63.6 419.68,-63.6 413.68,-57.6 413.68,-51.6 413.68,-51.6 413.68,-12 413.68,-12 413.68,-6 419.68,0 425.68,0 425.68,0 521.52,0 521.52,0 527.52,0 533.52,-6 533.52,-12 533.52,-12 533.52,-51.6 533.52,-51.6 533.52,-57.6 527.52,-63.6 521.52,-63.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"424.48\" y=\"-40.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_std_dev</text>\n", |
| "<text text-anchor=\"start\" x=\"460.85\" y=\"-12.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n", |
| "</g>\n", |
| "<!-- spend_std_dev->spend_zero_mean_unit_variance -->\n", |
| "<g id=\"edge7\" class=\"edge\">\n", |
| "<title>spend_std_dev->spend_zero_mean_unit_variance</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M533.79,-44.43C586.23,-55.63 664.59,-72.35 731.22,-86.57\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"730.25,-89.94 740.76,-88.61 731.71,-83.1 730.25,-89.94\"/>\n", |
| "</g>\n", |
| "<!-- signups->spend_per_signup -->\n", |
| "<g id=\"edge5\" class=\"edge\">\n", |
| "<title>signups->spend_per_signup</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M374.16,-308.48C379.52,-308.88 385.22,-309.3 391.06,-309.74\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"390.71,-313.22 400.94,-310.47 391.22,-306.24 390.71,-313.22\"/>\n", |
| "</g>\n", |
| "<!-- spend->spend_zero_mean -->\n", |
| "<g id=\"edge1\" class=\"edge\">\n", |
| "<title>spend->spend_zero_mean</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M368.19,-227.31C378.92,-231.16 391.22,-234.88 402.8,-236.8 464.89,-247.07 482.7,-249.18 544.4,-236.8 551.05,-235.47 557.81,-233.67 564.51,-231.57\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"565.18,-235.04 573.54,-228.53 562.94,-228.41 565.18,-235.04\"/>\n", |
| "</g>\n", |
| "<!-- spend->spend_mean -->\n", |
| "<g id=\"edge3\" class=\"edge\">\n", |
| "<title>spend->spend_mean</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M367.97,-210.58C380.36,-208.83 395.24,-206.73 409.84,-204.67\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"409.99,-208.18 419.4,-203.32 409.01,-201.25 409.99,-208.18\"/>\n", |
| "</g>\n", |
| "<!-- spend->spend_per_signup -->\n", |
| "<g id=\"edge4\" class=\"edge\">\n", |
| "<title>spend->spend_per_signup</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M368.09,-241.6C378.81,-250.83 391.13,-261.04 402.8,-269.8 406.07,-272.25 409.46,-274.72 412.91,-277.17\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"410.7,-279.89 420.9,-282.74 414.7,-274.15 410.7,-279.89\"/>\n", |
| "</g>\n", |
| "<!-- spend->avg_3wk_spend -->\n", |
| "<g id=\"edge8\" class=\"edge\">\n", |
| "<title>spend->avg_3wk_spend</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M368.18,-184.38C378.71,-174.43 390.88,-163.67 402.8,-154.8 403.94,-153.95 405.1,-153.1 406.28,-152.26\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"408.03,-155.3 414.3,-146.76 404.07,-149.53 408.03,-155.3\"/>\n", |
| "</g>\n", |
| "<!-- spend->spend_std_dev -->\n", |
| "<g id=\"edge10\" class=\"edge\">\n", |
| "<title>spend->spend_std_dev</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M346.61,-182.58C356.11,-151.53 374.05,-104.69 402.8,-72.8 403.5,-72.02 404.22,-71.26 404.95,-70.5\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"407.23,-73.16 412.27,-63.83 402.52,-67.99 407.23,-73.16\"/>\n", |
| "</g>\n", |
| "<!-- _base_df_inputs -->\n", |
| "<g id=\"node10\" class=\"node\">\n", |
| "<title>_base_df_inputs</title>\n", |
| "<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"152.6,-278.1 0,-278.1 0,-233.5 152.6,-233.5 152.6,-278.1\"/>\n", |
| "<text text-anchor=\"start\" x=\"14.8\" y=\"-250\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">base_df_location</text>\n", |
| "<text text-anchor=\"start\" x=\"122.8\" y=\"-250\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">str</text>\n", |
| "</g>\n", |
| "<!-- _base_df_inputs->base_df -->\n", |
| "<g id=\"edge9\" class=\"edge\">\n", |
| "<title>_base_df_inputs->base_df</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M152.72,-255.8C158.49,-255.8 164.25,-255.8 169.87,-255.8\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"169.62,-259.3 179.62,-255.8 169.62,-252.3 169.62,-259.3\"/>\n", |
| "</g>\n", |
| "<!-- input -->\n", |
| "<g id=\"node11\" class=\"node\">\n", |
| "<title>input</title>\n", |
| "<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"103.3,-333.1 49.3,-333.1 49.3,-296.5 103.3,-296.5 103.3,-333.1\"/>\n", |
| "<text text-anchor=\"middle\" x=\"76.3\" y=\"-309\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">input</text>\n", |
| "</g>\n", |
| "<!-- function -->\n", |
| "<g id=\"node12\" class=\"node\">\n", |
| "<title>function</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M98.72,-388.1C98.72,-388.1 53.87,-388.1 53.87,-388.1 47.87,-388.1 41.87,-382.1 41.87,-376.1 41.87,-376.1 41.87,-363.5 41.87,-363.5 41.87,-357.5 47.87,-351.5 53.87,-351.5 53.87,-351.5 98.72,-351.5 98.72,-351.5 104.72,-351.5 110.72,-357.5 110.72,-363.5 110.72,-363.5 110.72,-376.1 110.72,-376.1 110.72,-382.1 104.72,-388.1 98.72,-388.1\"/>\n", |
| "<text text-anchor=\"middle\" x=\"76.3\" y=\"-364\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">function</text>\n", |
| "</g>\n", |
| "</g>\n", |
| "</svg>\n" |
| ], |
| "text/plain": [ |
| "<graphviz.graphs.Digraph at 0x7f819937bb50>" |
| ] |
| }, |
| "metadata": {}, |
| "output_type": "display_data" |
| } |
| ], |
| "source": [ |
| "%%cell_to_module spend_calculations --display\n", |
| "\n", |
| "import polars as pl\n", |
| "from hamilton.function_modifiers import extract_columns\n", |
| "\n", |
| "@extract_columns(\"signups\", \"spend\")\n", |
| "def base_df(base_df_location: str) -> pl.DataFrame:\n", |
| " \"\"\"Loads base dataframe of data.\n", |
| "\n", |
| " :param base_df_location: just showing that we could load this from a file...\n", |
| " :return:\n", |
| " \"\"\"\n", |
| " return pl.DataFrame(\n", |
| " {\n", |
| " \"signups\": pl.Series([1, 10, 50, 100, 200, 400]),\n", |
| " \"spend\": pl.Series([10, 10, 20, 40, 40, 50]),\n", |
| " }\n", |
| " )\n", |
| "\n", |
| "def avg_3wk_spend(spend: pl.Series) -> pl.Series:\n", |
| " \"\"\"Rolling 3 week average spend.\"\"\"\n", |
| " return spend.rolling_mean(3)\n", |
| "\n", |
| "def spend_per_signup(spend: pl.Series, signups: pl.Series) -> pl.Series:\n", |
| " \"\"\"The cost per signup in relation to spend.\"\"\"\n", |
| " return spend / signups\n", |
| "\n", |
| "def spend_mean(spend: pl.Series) -> float:\n", |
| " \"\"\"Shows function creating a scalar. In this case it computes the mean of the entire column.\"\"\"\n", |
| " return spend.mean()\n", |
| "\n", |
| "def spend_zero_mean(spend: pl.Series, spend_mean: float) -> pl.Series:\n", |
| " \"\"\"Shows function that takes a scalar. In this case to zero mean spend.\"\"\"\n", |
| " return spend - spend_mean\n", |
| "\n", |
| "def spend_std_dev(spend: pl.Series) -> float:\n", |
| " \"\"\"Function that computes the standard deviation of the spend column.\"\"\"\n", |
| " return spend.std()\n", |
| "\n", |
| "def spend_zero_mean_unit_variance(spend_zero_mean: pl.Series, spend_std_dev: float) -> pl.Series:\n", |
| " \"\"\"Function showing one way to make spend have zero mean and unit variance.\"\"\"\n", |
| " return spend_zero_mean / spend_std_dev" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 3, |
| "metadata": { |
| "ExecuteTime": { |
| "end_time": "2024-09-19T04:16:08.144540Z", |
| "start_time": "2024-09-19T04:16:07.376233Z" |
| }, |
| "collapsed": false, |
| "jupyter": { |
| "outputs_hidden": false |
| }, |
| "pycharm": { |
| "name": "#%%\n" |
| } |
| }, |
| "outputs": [], |
| "source": [ |
| "from hamilton import driver, base\n", |
| "from hamilton.plugins import h_polars\n", |
| "\n", |
| "inputs = {\n", |
| " \"base_df_location\": \"dummy_value\",\n", |
| "}\n", |
| "adapter = base.SimplePythonGraphAdapter(result_builder=h_polars.PolarsDataFrameResult())\n", |
| "dr = (driver\n", |
| " .Builder()\n", |
| " .with_modules(spend_calculations)\n", |
| " .with_adapters(adapter)\n", |
| " .build()\n", |
| ")\n", |
| "\n", |
| "output_columns = [\n", |
| " \"spend\",\n", |
| " \"signups\",\n", |
| " \"avg_3wk_spend\",\n", |
| " \"spend_per_signup\",\n", |
| " \"spend_zero_mean_unit_variance\",\n", |
| "]" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 4, |
| "metadata": { |
| "ExecuteTime": { |
| "end_time": "2024-09-19T04:16:08.910716Z", |
| "start_time": "2024-09-19T04:16:08.440492Z" |
| }, |
| "collapsed": false, |
| "jupyter": { |
| "outputs_hidden": false |
| }, |
| "pycharm": { |
| "name": "#%%\n" |
| } |
| }, |
| "outputs": [ |
| { |
| "name": "stdout", |
| "output_type": "stream", |
| "text": [ |
| "shape: (6, 5)\n", |
| "┌───────┬─────────┬───────────────┬──────────────────┬───────────────────────────────┐\n", |
| "│ spend ┆ signups ┆ avg_3wk_spend ┆ spend_per_signup ┆ spend_zero_mean_unit_variance │\n", |
| "│ --- ┆ --- ┆ --- ┆ --- ┆ --- │\n", |
| "│ i64 ┆ i64 ┆ f64 ┆ f64 ┆ f64 │\n", |
| "╞═══════╪═════════╪═══════════════╪══════════════════╪═══════════════════════════════╡\n", |
| "│ 10 ┆ 1 ┆ null ┆ 10.0 ┆ -1.064405 │\n", |
| "│ 10 ┆ 10 ┆ null ┆ 1.0 ┆ -1.064405 │\n", |
| "│ 20 ┆ 50 ┆ 13.333333 ┆ 0.4 ┆ -0.483821 │\n", |
| "│ 40 ┆ 100 ┆ 23.333333 ┆ 0.4 ┆ 0.677349 │\n", |
| "│ 40 ┆ 200 ┆ 33.333333 ┆ 0.2 ┆ 0.677349 │\n", |
| "│ 50 ┆ 400 ┆ 43.333333 ┆ 0.125 ┆ 1.257934 │\n", |
| "└───────┴─────────┴───────────────┴──────────────────┴───────────────────────────────┘\n" |
| ] |
| }, |
| { |
| "data": { |
| "image/svg+xml": [ |
| "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n", |
| "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n", |
| " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n", |
| "<!-- Generated by graphviz version 12.0.0 (20240704.0754)\n", |
| " -->\n", |
| "<!-- Pages: 1 -->\n", |
| "<svg width=\"985pt\" height=\"468pt\"\n", |
| " viewBox=\"0.00 0.00 985.10 467.80\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n", |
| "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 463.8)\">\n", |
| "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-463.8 981.1,-463.8 981.1,4 -4,4\"/>\n", |
| "<g id=\"clust1\" class=\"cluster\">\n", |
| "<title>cluster__legend</title>\n", |
| "<polygon fill=\"#ffffff\" stroke=\"black\" points=\"33.88,-266.8 33.88,-451.8 118.72,-451.8 118.72,-266.8 33.88,-266.8\"/>\n", |
| "<text text-anchor=\"middle\" x=\"76.3\" y=\"-434.5\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">Legend</text>\n", |
| "</g>\n", |
| "<!-- spend_per_signup -->\n", |
| "<g id=\"node1\" class=\"node\">\n", |
| "<title>spend_per_signup</title>\n", |
| "<path fill=\"#ffc857\" stroke=\"black\" d=\"M532.4,-347.6C532.4,-347.6 414.8,-347.6 414.8,-347.6 408.8,-347.6 402.8,-341.6 402.8,-335.6 402.8,-335.6 402.8,-296 402.8,-296 402.8,-290 408.8,-284 414.8,-284 414.8,-284 532.4,-284 532.4,-284 538.4,-284 544.4,-290 544.4,-296 544.4,-296 544.4,-335.6 544.4,-335.6 544.4,-341.6 538.4,-347.6 532.4,-347.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"413.6\" y=\"-324.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_per_signup</text>\n", |
| "<text text-anchor=\"start\" x=\"454.48\" y=\"-296.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n", |
| "</g>\n", |
| "<!-- spend -->\n", |
| "<g id=\"node2\" class=\"node\">\n", |
| "<title>spend</title>\n", |
| "<path fill=\"#ffc857\" stroke=\"black\" d=\"M355.8,-224.6C355.8,-224.6 318.45,-224.6 318.45,-224.6 312.45,-224.6 306.45,-218.6 306.45,-212.6 306.45,-212.6 306.45,-173 306.45,-173 306.45,-167 312.45,-161 318.45,-161 318.45,-161 355.8,-161 355.8,-161 361.8,-161 367.8,-167 367.8,-173 367.8,-173 367.8,-212.6 367.8,-212.6 367.8,-218.6 361.8,-224.6 355.8,-224.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"317.25\" y=\"-201.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend</text>\n", |
| "<text text-anchor=\"start\" x=\"318\" y=\"-173.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n", |
| "</g>\n", |
| "<!-- spend->spend_per_signup -->\n", |
| "<g id=\"edge1\" class=\"edge\">\n", |
| "<title>spend->spend_per_signup</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M359.03,-224.73C370.66,-240.96 386.13,-260.26 402.8,-274.8 403.56,-275.47 404.34,-276.13 405.13,-276.78\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"402.69,-279.32 412.74,-282.68 406.98,-273.79 402.69,-279.32\"/>\n", |
| "</g>\n", |
| "<!-- avg_3wk_spend -->\n", |
| "<g id=\"node3\" class=\"node\">\n", |
| "<title>avg_3wk_spend</title>\n", |
| "<path fill=\"#ffc857\" stroke=\"black\" d=\"M524.52,-265.6C524.52,-265.6 422.68,-265.6 422.68,-265.6 416.68,-265.6 410.68,-259.6 410.68,-253.6 410.68,-253.6 410.68,-214 410.68,-214 410.68,-208 416.68,-202 422.68,-202 422.68,-202 524.52,-202 524.52,-202 530.52,-202 536.52,-208 536.52,-214 536.52,-214 536.52,-253.6 536.52,-253.6 536.52,-259.6 530.52,-265.6 524.52,-265.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"421.48\" y=\"-242.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">avg_3wk_spend</text>\n", |
| "<text text-anchor=\"start\" x=\"454.48\" y=\"-214.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n", |
| "</g>\n", |
| "<!-- spend->avg_3wk_spend -->\n", |
| "<g id=\"edge4\" class=\"edge\">\n", |
| "<title>spend->avg_3wk_spend</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M367.97,-201.9C377.47,-204.8 388.43,-208.14 399.6,-211.54\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"398.3,-214.81 408.89,-214.38 400.35,-208.11 398.3,-214.81\"/>\n", |
| "</g>\n", |
| "<!-- spend_mean -->\n", |
| "<g id=\"node4\" class=\"node\">\n", |
| "<title>spend_mean</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M514.02,-183.6C514.02,-183.6 433.18,-183.6 433.18,-183.6 427.18,-183.6 421.18,-177.6 421.18,-171.6 421.18,-171.6 421.18,-132 421.18,-132 421.18,-126 427.18,-120 433.18,-120 433.18,-120 514.02,-120 514.02,-120 520.02,-120 526.02,-126 526.02,-132 526.02,-132 526.02,-171.6 526.02,-171.6 526.02,-177.6 520.02,-183.6 514.02,-183.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"431.98\" y=\"-160.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_mean</text>\n", |
| "<text text-anchor=\"start\" x=\"460.85\" y=\"-132.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n", |
| "</g>\n", |
| "<!-- spend->spend_mean -->\n", |
| "<g id=\"edge5\" class=\"edge\">\n", |
| "<title>spend->spend_mean</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M367.97,-183.7C380.48,-179.89 395.53,-175.3 410.27,-170.8\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"410.91,-174.27 419.45,-168 408.87,-167.57 410.91,-174.27\"/>\n", |
| "</g>\n", |
| "<!-- spend_std_dev -->\n", |
| "<g id=\"node6\" class=\"node\">\n", |
| "<title>spend_std_dev</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M521.52,-63.6C521.52,-63.6 425.68,-63.6 425.68,-63.6 419.68,-63.6 413.68,-57.6 413.68,-51.6 413.68,-51.6 413.68,-12 413.68,-12 413.68,-6 419.68,0 425.68,0 425.68,0 521.52,0 521.52,0 527.52,0 533.52,-6 533.52,-12 533.52,-12 533.52,-51.6 533.52,-51.6 533.52,-57.6 527.52,-63.6 521.52,-63.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"424.48\" y=\"-40.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_std_dev</text>\n", |
| "<text text-anchor=\"start\" x=\"460.85\" y=\"-12.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n", |
| "</g>\n", |
| "<!-- spend->spend_std_dev -->\n", |
| "<g id=\"edge7\" class=\"edge\">\n", |
| "<title>spend->spend_std_dev</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M351.17,-160.65C362.29,-136 380.08,-102.18 402.8,-77.8 404.93,-75.51 407.2,-73.28 409.57,-71.12\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"411.42,-74.13 416.79,-65 406.89,-68.8 411.42,-74.13\"/>\n", |
| "</g>\n", |
| "<!-- spend_zero_mean -->\n", |
| "<g id=\"node9\" class=\"node\">\n", |
| "<title>spend_zero_mean</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M701.5,-123.6C701.5,-123.6 585.4,-123.6 585.4,-123.6 579.4,-123.6 573.4,-117.6 573.4,-111.6 573.4,-111.6 573.4,-72 573.4,-72 573.4,-66 579.4,-60 585.4,-60 585.4,-60 701.5,-60 701.5,-60 707.5,-60 713.5,-66 713.5,-72 713.5,-72 713.5,-111.6 713.5,-111.6 713.5,-117.6 707.5,-123.6 701.5,-123.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"584.2\" y=\"-100.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_zero_mean</text>\n", |
| "<text text-anchor=\"start\" x=\"624.33\" y=\"-72.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n", |
| "</g>\n", |
| "<!-- spend->spend_zero_mean -->\n", |
| "<g id=\"edge11\" class=\"edge\">\n", |
| "<title>spend->spend_zero_mean</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M354.6,-160.84C365.66,-142.89 382.01,-121.91 402.8,-110.8 451.1,-84.97 512.85,-80.63 561.58,-82.54\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"561.36,-86.03 571.52,-83.03 561.71,-79.04 561.36,-86.03\"/>\n", |
| "</g>\n", |
| "<!-- spend_mean->spend_zero_mean -->\n", |
| "<g id=\"edge12\" class=\"edge\">\n", |
| "<title>spend_mean->spend_zero_mean</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M526.33,-133.31C537.73,-129.23 550.06,-124.83 562.29,-120.46\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"563.31,-123.81 571.55,-117.14 560.96,-117.21 563.31,-123.81\"/>\n", |
| "</g>\n", |
| "<!-- base_df -->\n", |
| "<g id=\"node5\" class=\"node\">\n", |
| "<title>base_df</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M259.45,-265.6C259.45,-265.6 193.6,-265.6 193.6,-265.6 187.6,-265.6 181.6,-259.6 181.6,-253.6 181.6,-253.6 181.6,-214 181.6,-214 181.6,-208 187.6,-202 193.6,-202 193.6,-202 259.45,-202 259.45,-202 265.45,-202 271.45,-208 271.45,-214 271.45,-214 271.45,-253.6 271.45,-253.6 271.45,-259.6 265.45,-265.6 259.45,-265.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"201.02\" y=\"-242.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">base_df</text>\n", |
| "<text text-anchor=\"start\" x=\"192.4\" y=\"-214.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">DataFrame</text>\n", |
| "</g>\n", |
| "<!-- base_df->spend -->\n", |
| "<g id=\"edge3\" class=\"edge\">\n", |
| "<title>base_df->spend</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M271.7,-217.12C279.6,-214.14 287.8,-211.04 295.59,-208.1\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"296.73,-211.41 304.85,-204.61 294.26,-204.86 296.73,-211.41\"/>\n", |
| "</g>\n", |
| "<!-- signups -->\n", |
| "<g id=\"node7\" class=\"node\">\n", |
| "<title>signups</title>\n", |
| "<path fill=\"#ffc857\" stroke=\"black\" d=\"M361.8,-326.6C361.8,-326.6 312.45,-326.6 312.45,-326.6 306.45,-326.6 300.45,-320.6 300.45,-314.6 300.45,-314.6 300.45,-275 300.45,-275 300.45,-269 306.45,-263 312.45,-263 312.45,-263 361.8,-263 361.8,-263 367.8,-263 373.8,-269 373.8,-275 373.8,-275 373.8,-314.6 373.8,-314.6 373.8,-320.6 367.8,-326.6 361.8,-326.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"311.25\" y=\"-303.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">signups</text>\n", |
| "<text text-anchor=\"start\" x=\"318\" y=\"-275.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n", |
| "</g>\n", |
| "<!-- base_df->signups -->\n", |
| "<g id=\"edge8\" class=\"edge\">\n", |
| "<title>base_df->signups</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M271.7,-258.61C277.72,-261.99 283.91,-265.47 289.96,-268.87\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"288.21,-271.9 298.64,-273.75 291.64,-265.8 288.21,-271.9\"/>\n", |
| "</g>\n", |
| "<!-- spend_zero_mean_unit_variance -->\n", |
| "<g id=\"node8\" class=\"node\">\n", |
| "<title>spend_zero_mean_unit_variance</title>\n", |
| "<path fill=\"#ffc857\" stroke=\"black\" d=\"M965.1,-93.6C965.1,-93.6 754.5,-93.6 754.5,-93.6 748.5,-93.6 742.5,-87.6 742.5,-81.6 742.5,-81.6 742.5,-42 742.5,-42 742.5,-36 748.5,-30 754.5,-30 754.5,-30 965.1,-30 965.1,-30 971.1,-30 977.1,-36 977.1,-42 977.1,-42 977.1,-81.6 977.1,-81.6 977.1,-87.6 971.1,-93.6 965.1,-93.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"753.3\" y=\"-70.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_zero_mean_unit_variance</text>\n", |
| "<text text-anchor=\"start\" x=\"840.67\" y=\"-42.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n", |
| "</g>\n", |
| "<!-- spend_std_dev->spend_zero_mean_unit_variance -->\n", |
| "<g id=\"edge10\" class=\"edge\">\n", |
| "<title>spend_std_dev->spend_zero_mean_unit_variance</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M533.79,-36.42C586.12,-40.51 664.26,-46.61 730.81,-51.81\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"730.49,-55.29 740.73,-52.58 731.03,-48.31 730.49,-55.29\"/>\n", |
| "</g>\n", |
| "<!-- signups->spend_per_signup -->\n", |
| "<g id=\"edge2\" class=\"edge\">\n", |
| "<title>signups->spend_per_signup</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M374.16,-300.43C379.66,-301.29 385.51,-302.2 391.51,-303.14\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"390.53,-306.53 400.95,-304.61 391.61,-299.61 390.53,-306.53\"/>\n", |
| "</g>\n", |
| "<!-- spend_zero_mean->spend_zero_mean_unit_variance -->\n", |
| "<g id=\"edge9\" class=\"edge\">\n", |
| "<title>spend_zero_mean->spend_zero_mean_unit_variance</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M713.75,-82.1C719.34,-81.32 725.09,-80.51 730.92,-79.7\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"731.3,-83.18 740.72,-78.33 730.33,-76.25 731.3,-83.18\"/>\n", |
| "</g>\n", |
| "<!-- _base_df_inputs -->\n", |
| "<g id=\"node10\" class=\"node\">\n", |
| "<title>_base_df_inputs</title>\n", |
| "<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"152.6,-256.1 0,-256.1 0,-211.5 152.6,-211.5 152.6,-256.1\"/>\n", |
| "<text text-anchor=\"start\" x=\"14.8\" y=\"-228\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">base_df_location</text>\n", |
| "<text text-anchor=\"start\" x=\"122.8\" y=\"-228\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">str</text>\n", |
| "</g>\n", |
| "<!-- _base_df_inputs->base_df -->\n", |
| "<g id=\"edge6\" class=\"edge\">\n", |
| "<title>_base_df_inputs->base_df</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M152.72,-233.8C158.49,-233.8 164.25,-233.8 169.87,-233.8\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"169.62,-237.3 179.62,-233.8 169.62,-230.3 169.62,-237.3\"/>\n", |
| "</g>\n", |
| "<!-- input -->\n", |
| "<g id=\"node11\" class=\"node\">\n", |
| "<title>input</title>\n", |
| "<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"103.3,-311.1 49.3,-311.1 49.3,-274.5 103.3,-274.5 103.3,-311.1\"/>\n", |
| "<text text-anchor=\"middle\" x=\"76.3\" y=\"-287\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">input</text>\n", |
| "</g>\n", |
| "<!-- function -->\n", |
| "<g id=\"node12\" class=\"node\">\n", |
| "<title>function</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M98.72,-366.1C98.72,-366.1 53.87,-366.1 53.87,-366.1 47.87,-366.1 41.87,-360.1 41.87,-354.1 41.87,-354.1 41.87,-341.5 41.87,-341.5 41.87,-335.5 47.87,-329.5 53.87,-329.5 53.87,-329.5 98.72,-329.5 98.72,-329.5 104.72,-329.5 110.72,-335.5 110.72,-341.5 110.72,-341.5 110.72,-354.1 110.72,-354.1 110.72,-360.1 104.72,-366.1 98.72,-366.1\"/>\n", |
| "<text text-anchor=\"middle\" x=\"76.3\" y=\"-342\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">function</text>\n", |
| "</g>\n", |
| "<!-- output -->\n", |
| "<g id=\"node13\" class=\"node\">\n", |
| "<title>output</title>\n", |
| "<path fill=\"#ffc857\" stroke=\"black\" d=\"M93.85,-421.1C93.85,-421.1 58.75,-421.1 58.75,-421.1 52.75,-421.1 46.75,-415.1 46.75,-409.1 46.75,-409.1 46.75,-396.5 46.75,-396.5 46.75,-390.5 52.75,-384.5 58.75,-384.5 58.75,-384.5 93.85,-384.5 93.85,-384.5 99.85,-384.5 105.85,-390.5 105.85,-396.5 105.85,-396.5 105.85,-409.1 105.85,-409.1 105.85,-415.1 99.85,-421.1 93.85,-421.1\"/>\n", |
| "<text text-anchor=\"middle\" x=\"76.3\" y=\"-397\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">output</text>\n", |
| "</g>\n", |
| "</g>\n", |
| "</svg>\n" |
| ], |
| "text/plain": [ |
| "<graphviz.graphs.Digraph at 0x159d7d550>" |
| ] |
| }, |
| "execution_count": 4, |
| "metadata": {}, |
| "output_type": "execute_result" |
| } |
| ], |
| "source": [ |
| "# Execute the driver.\n", |
| "\n", |
| "df = dr.execute(output_columns, inputs=inputs)\n", |
| "print(df)\n", |
| "\n", |
| "# To visualize do `pip install \"sf-hamilton[visualization]\"` if you want these to work\n", |
| "dr.visualize_execution(output_columns, inputs=inputs)" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 5, |
| "metadata": { |
| "ExecuteTime": { |
| "end_time": "2024-09-19T04:02:35.738418Z", |
| "start_time": "2024-09-19T04:02:35.427023Z" |
| } |
| }, |
| "outputs": [ |
| { |
| "data": { |
| "image/svg+xml": [ |
| "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n", |
| "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n", |
| " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n", |
| "<!-- Generated by graphviz version 12.0.0 (20240704.0754)\n", |
| " -->\n", |
| "<!-- Pages: 1 -->\n", |
| "<svg width=\"985pt\" height=\"413pt\"\n", |
| " viewBox=\"0.00 0.00 985.10 412.80\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n", |
| "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 408.8)\">\n", |
| "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-408.8 981.1,-408.8 981.1,4 -4,4\"/>\n", |
| "<g id=\"clust1\" class=\"cluster\">\n", |
| "<title>cluster__legend</title>\n", |
| "<polygon fill=\"#ffffff\" stroke=\"black\" points=\"33.88,-266.8 33.88,-396.8 118.72,-396.8 118.72,-266.8 33.88,-266.8\"/>\n", |
| "<text text-anchor=\"middle\" x=\"76.3\" y=\"-379.5\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">Legend</text>\n", |
| "</g>\n", |
| "<!-- spend_per_signup -->\n", |
| "<g id=\"node1\" class=\"node\">\n", |
| "<title>spend_per_signup</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M532.4,-347.6C532.4,-347.6 414.8,-347.6 414.8,-347.6 408.8,-347.6 402.8,-341.6 402.8,-335.6 402.8,-335.6 402.8,-296 402.8,-296 402.8,-290 408.8,-284 414.8,-284 414.8,-284 532.4,-284 532.4,-284 538.4,-284 544.4,-290 544.4,-296 544.4,-296 544.4,-335.6 544.4,-335.6 544.4,-341.6 538.4,-347.6 532.4,-347.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"413.6\" y=\"-324.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_per_signup</text>\n", |
| "<text text-anchor=\"start\" x=\"454.48\" y=\"-296.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n", |
| "</g>\n", |
| "<!-- avg_3wk_spend -->\n", |
| "<g id=\"node2\" class=\"node\">\n", |
| "<title>avg_3wk_spend</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M524.52,-265.6C524.52,-265.6 422.68,-265.6 422.68,-265.6 416.68,-265.6 410.68,-259.6 410.68,-253.6 410.68,-253.6 410.68,-214 410.68,-214 410.68,-208 416.68,-202 422.68,-202 422.68,-202 524.52,-202 524.52,-202 530.52,-202 536.52,-208 536.52,-214 536.52,-214 536.52,-253.6 536.52,-253.6 536.52,-259.6 530.52,-265.6 524.52,-265.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"421.48\" y=\"-242.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">avg_3wk_spend</text>\n", |
| "<text text-anchor=\"start\" x=\"454.48\" y=\"-214.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n", |
| "</g>\n", |
| "<!-- spend -->\n", |
| "<g id=\"node3\" class=\"node\">\n", |
| "<title>spend</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M355.8,-224.6C355.8,-224.6 318.45,-224.6 318.45,-224.6 312.45,-224.6 306.45,-218.6 306.45,-212.6 306.45,-212.6 306.45,-173 306.45,-173 306.45,-167 312.45,-161 318.45,-161 318.45,-161 355.8,-161 355.8,-161 361.8,-161 367.8,-167 367.8,-173 367.8,-173 367.8,-212.6 367.8,-212.6 367.8,-218.6 361.8,-224.6 355.8,-224.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"317.25\" y=\"-201.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend</text>\n", |
| "<text text-anchor=\"start\" x=\"318\" y=\"-173.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n", |
| "</g>\n", |
| "<!-- spend->spend_per_signup -->\n", |
| "<g id=\"edge1\" class=\"edge\">\n", |
| "<title>spend->spend_per_signup</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M359.03,-224.73C370.66,-240.96 386.13,-260.26 402.8,-274.8 403.56,-275.47 404.34,-276.13 405.13,-276.78\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"402.69,-279.32 412.74,-282.68 406.98,-273.79 402.69,-279.32\"/>\n", |
| "</g>\n", |
| "<!-- spend->avg_3wk_spend -->\n", |
| "<g id=\"edge3\" class=\"edge\">\n", |
| "<title>spend->avg_3wk_spend</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M367.97,-201.9C377.47,-204.8 388.43,-208.14 399.6,-211.54\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"398.3,-214.81 408.89,-214.38 400.35,-208.11 398.3,-214.81\"/>\n", |
| "</g>\n", |
| "<!-- spend_mean -->\n", |
| "<g id=\"node4\" class=\"node\">\n", |
| "<title>spend_mean</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M514.02,-183.6C514.02,-183.6 433.18,-183.6 433.18,-183.6 427.18,-183.6 421.18,-177.6 421.18,-171.6 421.18,-171.6 421.18,-132 421.18,-132 421.18,-126 427.18,-120 433.18,-120 433.18,-120 514.02,-120 514.02,-120 520.02,-120 526.02,-126 526.02,-132 526.02,-132 526.02,-171.6 526.02,-171.6 526.02,-177.6 520.02,-183.6 514.02,-183.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"431.98\" y=\"-160.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_mean</text>\n", |
| "<text text-anchor=\"start\" x=\"460.85\" y=\"-132.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n", |
| "</g>\n", |
| "<!-- spend->spend_mean -->\n", |
| "<g id=\"edge5\" class=\"edge\">\n", |
| "<title>spend->spend_mean</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M367.97,-183.7C380.48,-179.89 395.53,-175.3 410.27,-170.8\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"410.91,-174.27 419.45,-168 408.87,-167.57 410.91,-174.27\"/>\n", |
| "</g>\n", |
| "<!-- spend_std_dev -->\n", |
| "<g id=\"node6\" class=\"node\">\n", |
| "<title>spend_std_dev</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M521.52,-63.6C521.52,-63.6 425.68,-63.6 425.68,-63.6 419.68,-63.6 413.68,-57.6 413.68,-51.6 413.68,-51.6 413.68,-12 413.68,-12 413.68,-6 419.68,0 425.68,0 425.68,0 521.52,0 521.52,0 527.52,0 533.52,-6 533.52,-12 533.52,-12 533.52,-51.6 533.52,-51.6 533.52,-57.6 527.52,-63.6 521.52,-63.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"424.48\" y=\"-40.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_std_dev</text>\n", |
| "<text text-anchor=\"start\" x=\"460.85\" y=\"-12.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n", |
| "</g>\n", |
| "<!-- spend->spend_std_dev -->\n", |
| "<g id=\"edge7\" class=\"edge\">\n", |
| "<title>spend->spend_std_dev</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M351.17,-160.65C362.29,-136 380.08,-102.18 402.8,-77.8 404.93,-75.51 407.2,-73.28 409.57,-71.12\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"411.42,-74.13 416.79,-65 406.89,-68.8 411.42,-74.13\"/>\n", |
| "</g>\n", |
| "<!-- spend_zero_mean -->\n", |
| "<g id=\"node8\" class=\"node\">\n", |
| "<title>spend_zero_mean</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M701.5,-123.6C701.5,-123.6 585.4,-123.6 585.4,-123.6 579.4,-123.6 573.4,-117.6 573.4,-111.6 573.4,-111.6 573.4,-72 573.4,-72 573.4,-66 579.4,-60 585.4,-60 585.4,-60 701.5,-60 701.5,-60 707.5,-60 713.5,-66 713.5,-72 713.5,-72 713.5,-111.6 713.5,-111.6 713.5,-117.6 707.5,-123.6 701.5,-123.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"584.2\" y=\"-100.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_zero_mean</text>\n", |
| "<text text-anchor=\"start\" x=\"624.33\" y=\"-72.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n", |
| "</g>\n", |
| "<!-- spend->spend_zero_mean -->\n", |
| "<g id=\"edge9\" class=\"edge\">\n", |
| "<title>spend->spend_zero_mean</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M354.6,-160.84C365.66,-142.89 382.01,-121.91 402.8,-110.8 451.1,-84.97 512.85,-80.63 561.58,-82.54\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"561.36,-86.03 571.52,-83.03 561.71,-79.04 561.36,-86.03\"/>\n", |
| "</g>\n", |
| "<!-- spend_mean->spend_zero_mean -->\n", |
| "<g id=\"edge10\" class=\"edge\">\n", |
| "<title>spend_mean->spend_zero_mean</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M526.33,-133.31C537.73,-129.23 550.06,-124.83 562.29,-120.46\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"563.31,-123.81 571.55,-117.14 560.96,-117.21 563.31,-123.81\"/>\n", |
| "</g>\n", |
| "<!-- base_df -->\n", |
| "<g id=\"node5\" class=\"node\">\n", |
| "<title>base_df</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M259.45,-265.6C259.45,-265.6 193.6,-265.6 193.6,-265.6 187.6,-265.6 181.6,-259.6 181.6,-253.6 181.6,-253.6 181.6,-214 181.6,-214 181.6,-208 187.6,-202 193.6,-202 193.6,-202 259.45,-202 259.45,-202 265.45,-202 271.45,-208 271.45,-214 271.45,-214 271.45,-253.6 271.45,-253.6 271.45,-259.6 265.45,-265.6 259.45,-265.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"201.02\" y=\"-242.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">base_df</text>\n", |
| "<text text-anchor=\"start\" x=\"192.4\" y=\"-214.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">DataFrame</text>\n", |
| "</g>\n", |
| "<!-- base_df->spend -->\n", |
| "<g id=\"edge4\" class=\"edge\">\n", |
| "<title>base_df->spend</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M271.7,-217.12C279.6,-214.14 287.8,-211.04 295.59,-208.1\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"296.73,-211.41 304.85,-204.61 294.26,-204.86 296.73,-211.41\"/>\n", |
| "</g>\n", |
| "<!-- signups -->\n", |
| "<g id=\"node7\" class=\"node\">\n", |
| "<title>signups</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M361.8,-326.6C361.8,-326.6 312.45,-326.6 312.45,-326.6 306.45,-326.6 300.45,-320.6 300.45,-314.6 300.45,-314.6 300.45,-275 300.45,-275 300.45,-269 306.45,-263 312.45,-263 312.45,-263 361.8,-263 361.8,-263 367.8,-263 373.8,-269 373.8,-275 373.8,-275 373.8,-314.6 373.8,-314.6 373.8,-320.6 367.8,-326.6 361.8,-326.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"311.25\" y=\"-303.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">signups</text>\n", |
| "<text text-anchor=\"start\" x=\"318\" y=\"-275.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n", |
| "</g>\n", |
| "<!-- base_df->signups -->\n", |
| "<g id=\"edge8\" class=\"edge\">\n", |
| "<title>base_df->signups</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M271.7,-258.61C277.72,-261.99 283.91,-265.47 289.96,-268.87\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"288.21,-271.9 298.64,-273.75 291.64,-265.8 288.21,-271.9\"/>\n", |
| "</g>\n", |
| "<!-- spend_zero_mean_unit_variance -->\n", |
| "<g id=\"node9\" class=\"node\">\n", |
| "<title>spend_zero_mean_unit_variance</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M965.1,-93.6C965.1,-93.6 754.5,-93.6 754.5,-93.6 748.5,-93.6 742.5,-87.6 742.5,-81.6 742.5,-81.6 742.5,-42 742.5,-42 742.5,-36 748.5,-30 754.5,-30 754.5,-30 965.1,-30 965.1,-30 971.1,-30 977.1,-36 977.1,-42 977.1,-42 977.1,-81.6 977.1,-81.6 977.1,-87.6 971.1,-93.6 965.1,-93.6\"/>\n", |
| "<text text-anchor=\"start\" x=\"753.3\" y=\"-70.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_zero_mean_unit_variance</text>\n", |
| "<text text-anchor=\"start\" x=\"840.67\" y=\"-42.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n", |
| "</g>\n", |
| "<!-- spend_std_dev->spend_zero_mean_unit_variance -->\n", |
| "<g id=\"edge12\" class=\"edge\">\n", |
| "<title>spend_std_dev->spend_zero_mean_unit_variance</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M533.79,-36.42C586.12,-40.51 664.26,-46.61 730.81,-51.81\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"730.49,-55.29 740.73,-52.58 731.03,-48.31 730.49,-55.29\"/>\n", |
| "</g>\n", |
| "<!-- signups->spend_per_signup -->\n", |
| "<g id=\"edge2\" class=\"edge\">\n", |
| "<title>signups->spend_per_signup</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M374.16,-300.43C379.66,-301.29 385.51,-302.2 391.51,-303.14\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"390.53,-306.53 400.95,-304.61 391.61,-299.61 390.53,-306.53\"/>\n", |
| "</g>\n", |
| "<!-- spend_zero_mean->spend_zero_mean_unit_variance -->\n", |
| "<g id=\"edge11\" class=\"edge\">\n", |
| "<title>spend_zero_mean->spend_zero_mean_unit_variance</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M713.75,-82.1C719.34,-81.32 725.09,-80.51 730.92,-79.7\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"731.3,-83.18 740.72,-78.33 730.33,-76.25 731.3,-83.18\"/>\n", |
| "</g>\n", |
| "<!-- _base_df_inputs -->\n", |
| "<g id=\"node10\" class=\"node\">\n", |
| "<title>_base_df_inputs</title>\n", |
| "<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"152.6,-256.1 0,-256.1 0,-211.5 152.6,-211.5 152.6,-256.1\"/>\n", |
| "<text text-anchor=\"start\" x=\"14.8\" y=\"-228\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">base_df_location</text>\n", |
| "<text text-anchor=\"start\" x=\"122.8\" y=\"-228\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">str</text>\n", |
| "</g>\n", |
| "<!-- _base_df_inputs->base_df -->\n", |
| "<g id=\"edge6\" class=\"edge\">\n", |
| "<title>_base_df_inputs->base_df</title>\n", |
| "<path fill=\"none\" stroke=\"black\" d=\"M152.72,-233.8C158.49,-233.8 164.25,-233.8 169.87,-233.8\"/>\n", |
| "<polygon fill=\"black\" stroke=\"black\" points=\"169.62,-237.3 179.62,-233.8 169.62,-230.3 169.62,-237.3\"/>\n", |
| "</g>\n", |
| "<!-- input -->\n", |
| "<g id=\"node11\" class=\"node\">\n", |
| "<title>input</title>\n", |
| "<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"103.3,-311.1 49.3,-311.1 49.3,-274.5 103.3,-274.5 103.3,-311.1\"/>\n", |
| "<text text-anchor=\"middle\" x=\"76.3\" y=\"-287\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">input</text>\n", |
| "</g>\n", |
| "<!-- function -->\n", |
| "<g id=\"node12\" class=\"node\">\n", |
| "<title>function</title>\n", |
| "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M98.72,-366.1C98.72,-366.1 53.87,-366.1 53.87,-366.1 47.87,-366.1 41.87,-360.1 41.87,-354.1 41.87,-354.1 41.87,-341.5 41.87,-341.5 41.87,-335.5 47.87,-329.5 53.87,-329.5 53.87,-329.5 98.72,-329.5 98.72,-329.5 104.72,-329.5 110.72,-335.5 110.72,-341.5 110.72,-341.5 110.72,-354.1 110.72,-354.1 110.72,-360.1 104.72,-366.1 98.72,-366.1\"/>\n", |
| "<text text-anchor=\"middle\" x=\"76.3\" y=\"-342\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">function</text>\n", |
| "</g>\n", |
| "</g>\n", |
| "</svg>\n" |
| ], |
| "text/plain": [ |
| "<graphviz.graphs.Digraph at 0x157859280>" |
| ] |
| }, |
| "execution_count": 5, |
| "metadata": {}, |
| "output_type": "execute_result" |
| } |
| ], |
| "source": [ |
| "dr.display_all_functions()" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": null, |
| "metadata": {}, |
| "outputs": [], |
| "source": [] |
| } |
| ], |
| "metadata": { |
| "kernelspec": { |
| "display_name": "hamilton", |
| "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.10.14" |
| } |
| }, |
| "nbformat": 4, |
| "nbformat_minor": 4 |
| } |