{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# A simple 4 layer contact network based on survey data\n", "\n", "Assume we want to build a simple contact network model consisting of 4 location types: households, school classes, work places and cities.\n", "To increase realism, we use survey data to create the population of actors and to define some of the location properties." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pop2net as p2n\n", "from pop2net.data_fakers.soep import soep_faker" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "In this example, we only use fake survey data (but of course you should real survey data here):" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | age | \n", "gender | \n", "work_hours_day | \n", "nace2_division | \n", "hid | \n", "pid | \n", "
---|---|---|---|---|---|---|
0 | \n", "86.0 | \n", "male | \n", "0.000000 | \n", "-2 | \n", "5199 | \n", "8974 | \n", "
1 | \n", "22.0 | \n", "male | \n", "8.098868 | \n", "86 | \n", "5199 | \n", "5637 | \n", "
2 | \n", "48.0 | \n", "male | \n", "7.740646 | \n", "87 | \n", "5199 | \n", "9915 | \n", "
3 | \n", "30.0 | \n", "male | \n", "0.000000 | \n", "-2 | \n", "5199 | \n", "9697 | \n", "
4 | \n", "64.0 | \n", "male | \n", "7.416154 | \n", "78 | \n", "9158 | \n", "9346 | \n", "
\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"
\\n\"+\n \"\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"
\\n\"+\n \"start | \\n: | \\n@start | \\n \\n
end | \\n: | \\n@end | \\n \\n
weight | \\n: | \\n@weight | \\n \\n
index | \\n: | \\n@index | \\n \\n
type | \\n: | \\n@type | \\n \\n
label | \\n: | \\n@label | \\n \\n
\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"
\\n\"+\n \"\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"
\\n\"+\n \"start | \\n: | \\n@start | \\n \\n
end | \\n: | \\n@end | \\n \\n
weight | \\n: | \\n@weight | \\n \\n
index | \\n: | \\n@index | \\n \\n
type | \\n: | \\n@type | \\n \\n