{ "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 agents 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", "65.0 | \n", "male | \n", "7.224629 | \n", "75 | \n", "7270 | \n", "4993 | \n", "
1 | \n", "44.0 | \n", "female | \n", "0.000000 | \n", "-2 | \n", "7270 | \n", "3968 | \n", "
2 | \n", "78.0 | \n", "female | \n", "3.583111 | \n", "84 | \n", "2836 | \n", "174 | \n", "
3 | \n", "3.0 | \n", "female | \n", "0.000000 | \n", "-2 | \n", "2836 | \n", "9598 | \n", "
4 | \n", "8.0 | \n", "male | \n", "0.000000 | \n", "-2 | \n", "2836 | \n", "1382 | \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
label | \\n: | \\n@label | \\n \\n
type | \\n: | \\n@type | \\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