blob: 1073e1561403bc191230495db390d46e5d772c0c [file]
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "initial_id",
"metadata": {
"collapsed": true
},
"outputs": [],
"source": "!pip install 'sf-hamilton[visualization]' pandas polars narwhals"
},
{
"metadata": {},
"cell_type": "markdown",
"source": [
"# run me in google colab\n",
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/dagworks-inc/hamilton/blob/main/examples/narwhals/notebook.ipynb)"
],
"id": "ce17944a48a226a9"
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-07-01T19:02:16.560492Z",
"start_time": "2024-07-01T19:02:06.001758Z"
}
},
"cell_type": "code",
"source": "%load_ext hamilton.plugins.jupyter_magic",
"id": "a4897501e00ed4e2",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"cannot import name 'PolarsDataType' from 'polars' (/Users/stefankrawczyk/.pyenv/versions/knowledge_retrieval-py39/lib/python3.9/site-packages/polars/__init__.py)\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/stefankrawczyk/.pyenv/versions/knowledge_retrieval-py39/lib/python3.9/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"
]
}
],
"execution_count": 2
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-07-01T19:04:42.572389Z",
"start_time": "2024-07-01T19:04:42.567211Z"
}
},
"cell_type": "code",
"source": [
"config = {\n",
" \"mode\": \"pandas\"\n",
"}\n",
"from hamilton import driver\n",
"builder = driver.Builder()"
],
"id": "6f0290a44e113076",
"outputs": [],
"execution_count": 8
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-07-01T19:06:01.729149Z",
"start_time": "2024-07-01T19:06:01.052739Z"
}
},
"cell_type": "code",
"source": [
"%%cell_to_module example --display --config '{\"mode\":\"pandas\"}'\n",
"\n",
"import narwhals as nw\n",
"import pandas as pd\n",
"import polars as pl\n",
"\n",
"from hamilton.function_modifiers import config, tag\n",
"\n",
"\n",
"@config.when(load=\"pandas\")\n",
"def df__pandas() -> nw.DataFrame:\n",
" return pd.DataFrame({\"a\": [1, 1, 2, 2, 3], \"b\": [4, 5, 6, 7, 8]})\n",
"\n",
"\n",
"@config.when(load=\"pandas\")\n",
"def series__pandas() -> nw.Series:\n",
" return pd.Series([1, 3])\n",
"\n",
"\n",
"@config.when(load=\"polars\")\n",
"def df__polars() -> nw.DataFrame:\n",
" return pl.DataFrame({\"a\": [1, 1, 2, 2, 3], \"b\": [4, 5, 6, 7, 8]})\n",
"\n",
"\n",
"@config.when(load=\"polars\")\n",
"def series__polars() -> nw.Series:\n",
" return pl.Series([1, 3])\n",
"\n",
"\n",
"@tag(nw_kwargs=[\"eager_only\"])\n",
"def example1(df: nw.DataFrame, series: nw.Series, col_name: str) -> int:\n",
" return df.filter(nw.col(col_name).is_in(series.to_numpy())).shape[0]\n",
"\n",
"\n",
"def group_by_mean(df: nw.DataFrame) -> nw.DataFrame:\n",
" return df.group_by(\"a\").agg(nw.col(\"b\").mean()).sort(\"a\")\n"
],
"id": "5c57c8bad9d004cd",
"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 10.0.1 (20240210.2158)\n -->\n<!-- Pages: 1 -->\n<svg width=\"326pt\" height=\"374pt\"\n viewBox=\"0.00 0.00 326.20 374.00\" 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 370)\">\n<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-370 322.2,-370 322.2,4 -4,4\"/>\n<g id=\"clust1\" class=\"cluster\">\n<title>cluster__legend</title>\n<polygon fill=\"#ffffff\" stroke=\"black\" points=\"38.88,-228 38.88,-358 123.73,-358 123.73,-228 38.88,-228\"/>\n<text text-anchor=\"middle\" x=\"81.3\" y=\"-340.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">Legend</text>\n</g>\n<!-- mode -->\n<g id=\"node1\" class=\"node\">\n<title>mode</title>\n<polygon fill=\"#ffffff\" stroke=\"black\" points=\"105.43,-50 51.18,-50 51.18,0 111.43,0 111.43,-44 105.43,-50\"/>\n<polyline fill=\"none\" stroke=\"black\" points=\"105.43,-50 105.43,-44\"/>\n<polyline fill=\"none\" stroke=\"black\" points=\"111.43,-44 105.43,-44\"/>\n<text text-anchor=\"start\" x=\"62.93\" y=\"-33.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">mode</text>\n<text text-anchor=\"start\" x=\"59.18\" y=\"-5.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">pandas</text>\n</g>\n<!-- group_by_mean -->\n<g id=\"node2\" class=\"node\">\n<title>group_by_mean</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M306.2,-121.8C306.2,-121.8 203.6,-121.8 203.6,-121.8 197.6,-121.8 191.6,-115.8 191.6,-109.8 191.6,-109.8 191.6,-70.2 191.6,-70.2 191.6,-64.2 197.6,-58.2 203.6,-58.2 203.6,-58.2 306.2,-58.2 306.2,-58.2 312.2,-58.2 318.2,-64.2 318.2,-70.2 318.2,-70.2 318.2,-109.8 318.2,-109.8 318.2,-115.8 312.2,-121.8 306.2,-121.8\"/>\n<text text-anchor=\"start\" x=\"202.4\" y=\"-98.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">group_by_mean</text>\n<text text-anchor=\"start\" x=\"220.77\" y=\"-70.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">DataFrame</text>\n</g>\n<!-- example1 -->\n<g id=\"node3\" class=\"node\">\n<title>example1</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M284.82,-205.8C284.82,-205.8 224.97,-205.8 224.97,-205.8 218.97,-205.8 212.97,-199.8 212.97,-193.8 212.97,-193.8 212.97,-154.2 212.97,-154.2 212.97,-148.2 218.97,-142.2 224.97,-142.2 224.97,-142.2 284.82,-142.2 284.82,-142.2 290.82,-142.2 296.82,-148.2 296.82,-154.2 296.82,-154.2 296.82,-193.8 296.82,-193.8 296.82,-199.8 290.82,-205.8 284.82,-205.8\"/>\n<text text-anchor=\"start\" x=\"223.77\" y=\"-182.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">example1</text>\n<text text-anchor=\"start\" x=\"247.77\" y=\"-154.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">int</text>\n</g>\n<!-- _group_by_mean_inputs -->\n<g id=\"node4\" class=\"node\">\n<title>_group_by_mean_inputs</title>\n<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"138.85,-112.3 23.75,-112.3 23.75,-67.7 138.85,-67.7 138.85,-112.3\"/>\n<text text-anchor=\"start\" x=\"38.55\" y=\"-84.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">df</text>\n<text text-anchor=\"start\" x=\"55.8\" y=\"-84.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">DataFrame</text>\n</g>\n<!-- _group_by_mean_inputs&#45;&gt;group_by_mean -->\n<g id=\"edge1\" class=\"edge\">\n<title>_group_by_mean_inputs&#45;&gt;group_by_mean</title>\n<path fill=\"none\" stroke=\"black\" d=\"M138.96,-90C152.08,-90 166.23,-90 179.97,-90\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"179.86,-93.5 189.86,-90 179.86,-86.5 179.86,-93.5\"/>\n</g>\n<!-- _example1_inputs -->\n<g id=\"node5\" class=\"node\">\n<title>_example1_inputs</title>\n<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"162.6,-217.3 0,-217.3 0,-130.7 162.6,-130.7 162.6,-217.3\"/>\n<text text-anchor=\"start\" x=\"26.3\" y=\"-189.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">series</text>\n<text text-anchor=\"start\" x=\"94.68\" y=\"-189.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">Series</text>\n<text text-anchor=\"start\" x=\"14.68\" y=\"-168.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">col_name</text>\n<text text-anchor=\"start\" x=\"106.3\" y=\"-168.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">str</text>\n<text text-anchor=\"start\" x=\"38.68\" y=\"-147.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">df</text>\n<text text-anchor=\"start\" x=\"79.68\" y=\"-147.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">DataFrame</text>\n</g>\n<!-- _example1_inputs&#45;&gt;example1 -->\n<g id=\"edge2\" class=\"edge\">\n<title>_example1_inputs&#45;&gt;example1</title>\n<path fill=\"none\" stroke=\"black\" d=\"M163.08,-174C176.12,-174 189.32,-174 201.46,-174\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"201.23,-177.5 211.23,-174 201.23,-170.5 201.23,-177.5\"/>\n</g>\n<!-- input -->\n<g id=\"node6\" class=\"node\">\n<title>input</title>\n<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"108.3,-272.3 54.3,-272.3 54.3,-235.7 108.3,-235.7 108.3,-272.3\"/>\n<text text-anchor=\"middle\" x=\"81.3\" y=\"-248.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">input</text>\n</g>\n<!-- function -->\n<g id=\"node7\" class=\"node\">\n<title>function</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M103.73,-327.3C103.73,-327.3 58.88,-327.3 58.88,-327.3 52.88,-327.3 46.88,-321.3 46.88,-315.3 46.88,-315.3 46.88,-302.7 46.88,-302.7 46.88,-296.7 52.88,-290.7 58.88,-290.7 58.88,-290.7 103.73,-290.7 103.73,-290.7 109.72,-290.7 115.73,-296.7 115.73,-302.7 115.73,-302.7 115.73,-315.3 115.73,-315.3 115.73,-321.3 109.73,-327.3 103.73,-327.3\"/>\n<text text-anchor=\"middle\" x=\"81.3\" y=\"-303.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">function</text>\n</g>\n</g>\n</svg>\n",
"text/plain": [
"<graphviz.graphs.Digraph at 0x1478d0f70>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"execution_count": 12
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-07-01T19:08:20.197966Z",
"start_time": "2024-07-01T19:08:20.151820Z"
}
},
"cell_type": "code",
"source": [
"from hamilton import base, driver\n",
"from hamilton.plugins import h_narwhals, h_polars\n",
"# pandas\n",
"dr = (\n",
" driver.Builder()\n",
" .with_config({\"load\": \"pandas\"})\n",
" .with_modules(example)\n",
" .with_adapters(\n",
" h_narwhals.NarwhalsAdapter(),\n",
" h_narwhals.NarwhalsDataFrameResultBuilder(base.PandasDataFrameResult()),\n",
" )\n",
" .build()\n",
")\n",
"result = dr.execute([example.group_by_mean, example.example1], inputs={\"col_name\": \"a\"})\n",
"result"
],
"id": "4ec491ce248b32ec",
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING: a single pandas index was found, but there are also 1 outputs without an index. Please check whether the dataframe created matches what what you expect to happen.\n"
]
},
{
"data": {
"text/plain": [
" group_by_mean.a group_by_mean.b example1\n",
"0 1 4.5 3\n",
"1 2 6.5 3\n",
"2 3 8.0 3"
],
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>group_by_mean.a</th>\n",
" <th>group_by_mean.b</th>\n",
" <th>example1</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1</td>\n",
" <td>4.5</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2</td>\n",
" <td>6.5</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>3</td>\n",
" <td>8.0</td>\n",
" <td>3</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": 18
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-07-01T19:08:25.361471Z",
"start_time": "2024-07-01T19:08:25.322417Z"
}
},
"cell_type": "code",
"source": [
"# polars\n",
"dr = (\n",
" driver.Builder()\n",
" .with_config({\"load\": \"polars\"})\n",
" .with_modules(example)\n",
" .with_adapters(\n",
" h_narwhals.NarwhalsAdapter(),\n",
" h_narwhals.NarwhalsDataFrameResultBuilder(h_polars.PolarsDataFrameResult()),\n",
" )\n",
" .build()\n",
")\n",
"result= dr.execute([example.group_by_mean, example.example1], inputs={\"col_name\": \"a\"})\n",
"result"
],
"id": "b9e65f6b29a58a5d",
"outputs": [
{
"data": {
"text/plain": [
"shape: (3, 2)\n",
"┌───────────────┬──────────┐\n",
"│ group_by_mean ┆ example1 │\n",
"│ --- ┆ --- │\n",
"│ struct[2] ┆ i32 │\n",
"╞═══════════════╪══════════╡\n",
"│ {1,4.5} ┆ 3 │\n",
"│ {2,6.5} ┆ 3 │\n",
"│ {3,8.0} ┆ 3 │\n",
"└───────────────┴──────────┘"
],
"text/html": [
"<div><style>\n",
".dataframe > thead > tr,\n",
".dataframe > tbody > tr {\n",
" text-align: right;\n",
" white-space: pre-wrap;\n",
"}\n",
"</style>\n",
"<small>shape: (3, 2)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>group_by_mean</th><th>example1</th></tr><tr><td>struct[2]</td><td>i32</td></tr></thead><tbody><tr><td>{1,4.5}</td><td>3</td></tr><tr><td>{2,6.5}</td><td>3</td></tr><tr><td>{3,8.0}</td><td>3</td></tr></tbody></table></div>"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": 19
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-07-01T19:07:42.534409Z",
"start_time": "2024-07-01T19:07:41.961806Z"
}
},
"cell_type": "code",
"source": "dr.display_all_functions()",
"id": "c17d7b45b69cee61",
"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 10.0.1 (20240210.2158)\n -->\n<!-- Pages: 1 -->\n<svg width=\"273pt\" height=\"486pt\"\n viewBox=\"0.00 0.00 273.45 486.00\" 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 482)\">\n<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-482 269.45,-482 269.45,4 -4,4\"/>\n<g id=\"clust1\" class=\"cluster\">\n<title>cluster__legend</title>\n<polygon fill=\"#ffffff\" stroke=\"black\" points=\"12.5,-286 12.5,-470 97.35,-470 97.35,-286 12.5,-286\"/>\n<text text-anchor=\"middle\" x=\"54.93\" y=\"-452.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">Legend</text>\n</g>\n<!-- load -->\n<g id=\"node1\" class=\"node\">\n<title>load</title>\n<polygon fill=\"#ffffff\" stroke=\"black\" points=\"75.93,-50 27.93,-50 27.93,0 81.93,0 81.93,-44 75.93,-50\"/>\n<polyline fill=\"none\" stroke=\"black\" points=\"75.93,-50 75.93,-44\"/>\n<polyline fill=\"none\" stroke=\"black\" points=\"81.93,-44 75.93,-44\"/>\n<text text-anchor=\"start\" x=\"41.05\" y=\"-33.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">load</text>\n<text text-anchor=\"start\" x=\"36.55\" y=\"-5.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">polars</text>\n</g>\n<!-- group_by_mean -->\n<g id=\"node2\" class=\"node\">\n<title>group_by_mean</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M253.45,-275.8C253.45,-275.8 150.85,-275.8 150.85,-275.8 144.85,-275.8 138.85,-269.8 138.85,-263.8 138.85,-263.8 138.85,-224.2 138.85,-224.2 138.85,-218.2 144.85,-212.2 150.85,-212.2 150.85,-212.2 253.45,-212.2 253.45,-212.2 259.45,-212.2 265.45,-218.2 265.45,-224.2 265.45,-224.2 265.45,-263.8 265.45,-263.8 265.45,-269.8 259.45,-275.8 253.45,-275.8\"/>\n<text text-anchor=\"start\" x=\"149.65\" y=\"-252.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">group_by_mean</text>\n<text text-anchor=\"start\" x=\"168.02\" y=\"-224.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">DataFrame</text>\n</g>\n<!-- series -->\n<g id=\"node3\" class=\"node\">\n<title>series</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M91.23,-193.8C91.23,-193.8 18.63,-193.8 18.63,-193.8 12.63,-193.8 6.63,-187.8 6.63,-181.8 6.63,-181.8 6.63,-142.2 6.63,-142.2 6.63,-136.2 12.63,-130.2 18.63,-130.2 18.63,-130.2 91.23,-130.2 91.23,-130.2 97.23,-130.2 103.23,-136.2 103.23,-142.2 103.23,-142.2 103.23,-181.8 103.23,-181.8 103.23,-187.8 97.23,-193.8 91.23,-193.8\"/>\n<text text-anchor=\"start\" x=\"17.43\" y=\"-170.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">series: load</text>\n<text text-anchor=\"start\" x=\"35.8\" y=\"-142.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n</g>\n<!-- example1 -->\n<g id=\"node4\" class=\"node\">\n<title>example1</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M232.07,-193.8C232.07,-193.8 172.22,-193.8 172.22,-193.8 166.22,-193.8 160.22,-187.8 160.22,-181.8 160.22,-181.8 160.22,-142.2 160.22,-142.2 160.22,-136.2 166.22,-130.2 172.22,-130.2 172.22,-130.2 232.07,-130.2 232.07,-130.2 238.07,-130.2 244.07,-136.2 244.07,-142.2 244.07,-142.2 244.07,-181.8 244.07,-181.8 244.07,-187.8 238.07,-193.8 232.07,-193.8\"/>\n<text text-anchor=\"start\" x=\"171.02\" y=\"-170.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">example1</text>\n<text text-anchor=\"start\" x=\"195.02\" y=\"-142.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">int</text>\n</g>\n<!-- series&#45;&gt;example1 -->\n<g id=\"edge3\" class=\"edge\">\n<title>series&#45;&gt;example1</title>\n<path fill=\"none\" stroke=\"black\" d=\"M103.48,-162C117.84,-162 133.69,-162 148.37,-162\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"148.32,-165.5 158.32,-162 148.32,-158.5 148.32,-165.5\"/>\n</g>\n<!-- df -->\n<g id=\"node5\" class=\"node\">\n<title>df</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M87.85,-275.8C87.85,-275.8 22,-275.8 22,-275.8 16,-275.8 10,-269.8 10,-263.8 10,-263.8 10,-224.2 10,-224.2 10,-218.2 16,-212.2 22,-212.2 22,-212.2 87.85,-212.2 87.85,-212.2 93.85,-212.2 99.85,-218.2 99.85,-224.2 99.85,-224.2 99.85,-263.8 99.85,-263.8 99.85,-269.8 93.85,-275.8 87.85,-275.8\"/>\n<text text-anchor=\"start\" x=\"30.55\" y=\"-252.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">df: load</text>\n<text text-anchor=\"start\" x=\"20.8\" y=\"-224.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">DataFrame</text>\n</g>\n<!-- df&#45;&gt;group_by_mean -->\n<g id=\"edge1\" class=\"edge\">\n<title>df&#45;&gt;group_by_mean</title>\n<path fill=\"none\" stroke=\"black\" d=\"M100.29,-244C108.89,-244 118.11,-244 127.36,-244\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"127.1,-247.5 137.1,-244 127.1,-240.5 127.1,-247.5\"/>\n</g>\n<!-- df&#45;&gt;example1 -->\n<g id=\"edge2\" class=\"edge\">\n<title>df&#45;&gt;example1</title>\n<path fill=\"none\" stroke=\"black\" d=\"M100.29,-218.95C116.04,-210.06 133.89,-199.98 150.15,-190.8\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"151.73,-193.93 158.71,-185.96 148.29,-187.83 151.73,-193.93\"/>\n</g>\n<!-- _example1_inputs -->\n<g id=\"node6\" class=\"node\">\n<title>_example1_inputs</title>\n<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"109.85,-112.3 0,-112.3 0,-67.7 109.85,-67.7 109.85,-112.3\"/>\n<text text-anchor=\"start\" x=\"14.8\" y=\"-84.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">col_name</text>\n<text text-anchor=\"start\" x=\"80.05\" y=\"-84.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">str</text>\n</g>\n<!-- _example1_inputs&#45;&gt;example1 -->\n<g id=\"edge4\" class=\"edge\">\n<title>_example1_inputs&#45;&gt;example1</title>\n<path fill=\"none\" stroke=\"black\" d=\"M101.88,-112.78C117.14,-120.35 134.24,-128.83 149.89,-136.58\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"148.05,-139.58 158.57,-140.89 151.16,-133.31 148.05,-139.58\"/>\n</g>\n<!-- config -->\n<g id=\"node7\" class=\"node\">\n<title>config</title>\n<polygon fill=\"#ffffff\" stroke=\"black\" points=\"75.93,-330 27.93,-330 27.93,-294 81.93,-294 81.93,-324 75.93,-330\"/>\n<polyline fill=\"none\" stroke=\"black\" points=\"75.93,-330 75.93,-324\"/>\n<polyline fill=\"none\" stroke=\"black\" points=\"81.93,-324 75.93,-324\"/>\n<text text-anchor=\"middle\" x=\"54.93\" y=\"-306.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">config</text>\n</g>\n<!-- input -->\n<g id=\"node8\" class=\"node\">\n<title>input</title>\n<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"81.93,-384.3 27.93,-384.3 27.93,-347.7 81.93,-347.7 81.93,-384.3\"/>\n<text text-anchor=\"middle\" x=\"54.93\" y=\"-360.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">input</text>\n</g>\n<!-- function -->\n<g id=\"node9\" class=\"node\">\n<title>function</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M77.35,-439.3C77.35,-439.3 32.5,-439.3 32.5,-439.3 26.5,-439.3 20.5,-433.3 20.5,-427.3 20.5,-427.3 20.5,-414.7 20.5,-414.7 20.5,-408.7 26.5,-402.7 32.5,-402.7 32.5,-402.7 77.35,-402.7 77.35,-402.7 83.35,-402.7 89.35,-408.7 89.35,-414.7 89.35,-414.7 89.35,-427.3 89.35,-427.3 89.35,-433.3 83.35,-439.3 77.35,-439.3\"/>\n<text text-anchor=\"middle\" x=\"54.93\" y=\"-415.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">function</text>\n</g>\n</g>\n</svg>\n",
"text/plain": [
"<graphviz.graphs.Digraph at 0x147810cd0>"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": 15
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": "",
"id": "db8cb54bc64bbd27"
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}