kopia lustrzana https://github.com/anitagraser/ogd-at-lab
Update mobility.ipynb
rodzic
583737f181
commit
a78e48ca30
|
@ -45,14 +45,54 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"ID = 3\n",
|
||||
"def plot_uber(source_id, attribute_col, month, *args, **kwargs):\n",
|
||||
" return ( gdf[(gdf.sourceid==source_id) & (gdf.month==month)].dropna(subset=[attribute_col]).hvplot(\n",
|
||||
" geo=True, tiles='OSM', c=attribute_col, title=f'{attribute_col.title()} - Month: 2020-{month}', *args, **kwargs) * \n",
|
||||
" gdf[gdf.index==source_id].hvplot(geo=True).opts(active_tools=['wheel_zoom']))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"COL = 'mean_travel_time'\n",
|
||||
"MONTH = 1\n",
|
||||
"( \n",
|
||||
" gdf[(gdf.sourceid==ID) & (gdf.month==MONTH)].dropna(subset=[COL]).hvplot(\n",
|
||||
" geo=True, tiles='OSM', c=COL, title=f'{COL.title()} - Month: 2020-{MONTH}') * \n",
|
||||
" gdf[gdf.index==ID].hvplot(geo=True).opts(active_tools=['wheel_zoom'])\n",
|
||||
")"
|
||||
"ID = 1\n",
|
||||
"plot_uber(ID, COL, 1) + plot_uber(ID, COL, 2) + plot_uber(ID, COL, 3)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"jan = gdf[gdf.month==1].groupby('sourceid').count()\n",
|
||||
"feb = gdf[gdf.month==2].groupby('sourceid').count()\n",
|
||||
"mar = gdf[gdf.month==3].groupby('sourceid').count() "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"joined = feb.join(mar, lsuffix='_feb', rsuffix='_mar')\n",
|
||||
"diff = joined[f'{COL}_mar'] - joined[f'{COL}_feb'] \n",
|
||||
"diff.hvplot.hist(title='Histogram of destination area counts (March 2020 - Feb 2020)')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"joined = jan.join(feb, lsuffix='_jan', rsuffix='_feb')\n",
|
||||
"diff = joined[f'{COL}_feb'] - joined[f'{COL}_jan'] \n",
|
||||
"diff.hvplot.hist(title='Histogram of destination area counts (Feb 2020 - Jan 2020)')"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue