From 4cf7c5e7c8dfb65856133c62076c67e18ab08cb4 Mon Sep 17 00:00:00 2001 From: Nick Robison Date: Tue, 22 Sep 2020 10:01:51 -0400 Subject: [PATCH] Fix formatting. --- python/Contact Simulation.ipynb | 353 +++++++++++++++++++++++++++++++- 1 file changed, 347 insertions(+), 6 deletions(-) diff --git a/python/Contact Simulation.ipynb b/python/Contact Simulation.ipynb index 29a26b45..474332d3 100644 --- a/python/Contact Simulation.ipynb +++ b/python/Contact Simulation.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -19,7 +19,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -28,9 +28,249 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
Dask DataFrame Structure:
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
safegraph_place_idlocation_namestreet_addresscityregionpostal_codeiso_country_codesafegraph_brand_idsbrandsdate_range_startdate_range_endraw_visit_countsraw_visitor_countsvisits_by_dayvisits_by_each_hourpoi_cbgvisitor_home_cbgsvisitor_daytime_cbgsvisitor_country_of_origindistance_from_homemedian_dwellbucketed_dwell_timesrelated_same_day_brandrelated_same_week_branddevice_type
npartitions=10
objectobjectobjectobjectobjectint64objectobjectobjectobjectobjectint64int64objectobjectfloat64objectobjectobjectfloat64float64objectobjectobjectobject
...........................................................................
..............................................................................
...........................................................................
...........................................................................
\n", + "
\n", + "
Dask Name: repartition, 14 tasks
" + ], + "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" @@ -38,9 +278,110 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
safegraph_place_idbucketed_dwell_timesraw_visit_countsmedian_dwelldwell_array
0sg:0013bd02b3564a9187a52f8e2799233e{\"<5\":2,\"5-20\":15,\"21-60\":7,\"61-240\":13,\">240\"...5974.0[2, 15, 7, 13, 22]
1sg:001955fa1c994b4c8c877316a66dd986{\"<5\":7,\"5-20\":146,\"21-60\":29,\"61-240\":6,\">240...19210.0[7, 146, 29, 6, 4]
2sg:001e39c6b18645a5950b13a278b242c3{\"<5\":2,\"5-20\":57,\"21-60\":22,\"61-240\":23,\">240...12521.0[2, 57, 22, 23, 21]
3sg:0023804ee36c4056886ef54e5a0cb773{\"<5\":1,\"5-20\":12,\"21-60\":5,\"61-240\":13,\">240\"...54165.0[1, 12, 5, 13, 23]
4sg:00267c6356804259b6c92ba31c842f5a{\"<5\":0,\"5-20\":19,\"21-60\":10,\"61-240\":7,\">240\":4}4022.5[0, 19, 10, 7, 4]
\n", + "
" + ], + "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",