Skip to content

Commit

Permalink
Fix formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickrobison-usds committed Sep 22, 2020
1 parent 73fe54d commit 4cf7c5e
Showing 1 changed file with 347 additions and 6 deletions.
353 changes: 347 additions & 6 deletions python/Contact Simulation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -19,7 +19,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -28,19 +28,360 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<div><strong>Dask DataFrame Structure:</strong></div>\n",
"<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>safegraph_place_id</th>\n",
" <th>location_name</th>\n",
" <th>street_address</th>\n",
" <th>city</th>\n",
" <th>region</th>\n",
" <th>postal_code</th>\n",
" <th>iso_country_code</th>\n",
" <th>safegraph_brand_ids</th>\n",
" <th>brands</th>\n",
" <th>date_range_start</th>\n",
" <th>date_range_end</th>\n",
" <th>raw_visit_counts</th>\n",
" <th>raw_visitor_counts</th>\n",
" <th>visits_by_day</th>\n",
" <th>visits_by_each_hour</th>\n",
" <th>poi_cbg</th>\n",
" <th>visitor_home_cbgs</th>\n",
" <th>visitor_daytime_cbgs</th>\n",
" <th>visitor_country_of_origin</th>\n",
" <th>distance_from_home</th>\n",
" <th>median_dwell</th>\n",
" <th>bucketed_dwell_times</th>\n",
" <th>related_same_day_brand</th>\n",
" <th>related_same_week_brand</th>\n",
" <th>device_type</th>\n",
" </tr>\n",
" <tr>\n",
" <th>npartitions=10</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th></th>\n",
" <td>object</td>\n",
" <td>object</td>\n",
" <td>object</td>\n",
" <td>object</td>\n",
" <td>object</td>\n",
" <td>int64</td>\n",
" <td>object</td>\n",
" <td>object</td>\n",
" <td>object</td>\n",
" <td>object</td>\n",
" <td>object</td>\n",
" <td>int64</td>\n",
" <td>int64</td>\n",
" <td>object</td>\n",
" <td>object</td>\n",
" <td>float64</td>\n",
" <td>object</td>\n",
" <td>object</td>\n",
" <td>object</td>\n",
" <td>float64</td>\n",
" <td>float64</td>\n",
" <td>object</td>\n",
" <td>object</td>\n",
" <td>object</td>\n",
" <td>object</td>\n",
" </tr>\n",
" <tr>\n",
" <th></th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th></th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th></th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>\n",
"<div>Dask Name: repartition, 14 tasks</div>"
],
"text/plain": [
"Dask DataFrame Structure:\n",
" safegraph_place_id location_name street_address city region postal_code iso_country_code safegraph_brand_ids brands date_range_start date_range_end raw_visit_counts raw_visitor_counts visits_by_day visits_by_each_hour poi_cbg visitor_home_cbgs visitor_daytime_cbgs visitor_country_of_origin distance_from_home median_dwell bucketed_dwell_times related_same_day_brand related_same_week_brand device_type\n",
"npartitions=10 \n",
" object object object object object int64 object object object object object int64 int64 object object float64 object object object float64 float64 object object object object\n",
" ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...\n",
"... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...\n",
" ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...\n",
" ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...\n",
"Dask Name: repartition, 14 tasks"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df = patterns.repartition(10)\n",
"df"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"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>safegraph_place_id</th>\n",
" <th>bucketed_dwell_times</th>\n",
" <th>raw_visit_counts</th>\n",
" <th>median_dwell</th>\n",
" <th>dwell_array</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>sg:0013bd02b3564a9187a52f8e2799233e</td>\n",
" <td>{\"&lt;5\":2,\"5-20\":15,\"21-60\":7,\"61-240\":13,\"&gt;240\"...</td>\n",
" <td>59</td>\n",
" <td>74.0</td>\n",
" <td>[2, 15, 7, 13, 22]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>sg:001955fa1c994b4c8c877316a66dd986</td>\n",
" <td>{\"&lt;5\":7,\"5-20\":146,\"21-60\":29,\"61-240\":6,\"&gt;240...</td>\n",
" <td>192</td>\n",
" <td>10.0</td>\n",
" <td>[7, 146, 29, 6, 4]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>sg:001e39c6b18645a5950b13a278b242c3</td>\n",
" <td>{\"&lt;5\":2,\"5-20\":57,\"21-60\":22,\"61-240\":23,\"&gt;240...</td>\n",
" <td>125</td>\n",
" <td>21.0</td>\n",
" <td>[2, 57, 22, 23, 21]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>sg:0023804ee36c4056886ef54e5a0cb773</td>\n",
" <td>{\"&lt;5\":1,\"5-20\":12,\"21-60\":5,\"61-240\":13,\"&gt;240\"...</td>\n",
" <td>54</td>\n",
" <td>165.0</td>\n",
" <td>[1, 12, 5, 13, 23]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>sg:00267c6356804259b6c92ba31c842f5a</td>\n",
" <td>{\"&lt;5\":0,\"5-20\":19,\"21-60\":10,\"61-240\":7,\"&gt;240\":4}</td>\n",
" <td>40</td>\n",
" <td>22.5</td>\n",
" <td>[0, 19, 10, 7, 4]</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" safegraph_place_id \\\n",
"0 sg:0013bd02b3564a9187a52f8e2799233e \n",
"1 sg:001955fa1c994b4c8c877316a66dd986 \n",
"2 sg:001e39c6b18645a5950b13a278b242c3 \n",
"3 sg:0023804ee36c4056886ef54e5a0cb773 \n",
"4 sg:00267c6356804259b6c92ba31c842f5a \n",
"\n",
" bucketed_dwell_times raw_visit_counts \\\n",
"0 {\"<5\":2,\"5-20\":15,\"21-60\":7,\"61-240\":13,\">240\"... 59 \n",
"1 {\"<5\":7,\"5-20\":146,\"21-60\":29,\"61-240\":6,\">240... 192 \n",
"2 {\"<5\":2,\"5-20\":57,\"21-60\":22,\"61-240\":23,\">240... 125 \n",
"3 {\"<5\":1,\"5-20\":12,\"21-60\":5,\"61-240\":13,\">240\"... 54 \n",
"4 {\"<5\":0,\"5-20\":19,\"21-60\":10,\"61-240\":7,\">240\":4} 40 \n",
"\n",
" median_dwell dwell_array \n",
"0 74.0 [2, 15, 7, 13, 22] \n",
"1 10.0 [7, 146, 29, 6, 4] \n",
"2 21.0 [2, 57, 22, 23, 21] \n",
"3 165.0 [1, 12, 5, 13, 23] \n",
"4 22.5 [0, 19, 10, 7, 4] "
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import json\n",
"\n",
Expand Down

0 comments on commit 4cf7c5e

Please sign in to comment.