import hvplot.pandas
from utils.dataaccess import get_uber_movement_gdf
Source: https://movement.uber.com/explore/vienna/travel-times
© 2021 Copyright Uber Technologies. Data made available under the Creative Commons, Attribution Non-Commercial license
gdf = get_uber_movement_gdf()
def plot_uber(source_id, attribute_col, month, *args, **kwargs):
return ( gdf[(gdf.sourceid==source_id) & (gdf.month==month)].dropna(subset=[attribute_col]).hvplot(
geo=True, tiles='OSM', c=attribute_col, title=f'{attribute_col.title()} - Month: 2020-{month}', *args, **kwargs) *
gdf[gdf.index==source_id].hvplot(geo=True).opts(active_tools=['wheel_zoom']))
COL = 'mean_travel_time'
ID = 1
plot_uber(ID, COL, 1) + plot_uber(ID, COL, 2) + plot_uber(ID, COL, 3)
jan = gdf[gdf.month==1].groupby('sourceid').count()
feb = gdf[gdf.month==2].groupby('sourceid').count()
mar = gdf[gdf.month==3].groupby('sourceid').count()
joined = feb.join(mar, lsuffix='_feb', rsuffix='_mar')
diff = joined[f'{COL}_mar'] - joined[f'{COL}_feb']
diff.hvplot.hist(title='Histogram of destination area counts (March 2020 - Feb 2020)')
joined = jan.join(feb, lsuffix='_jan', rsuffix='_feb')
diff = joined[f'{COL}_feb'] - joined[f'{COL}_jan']
diff.hvplot.hist(title='Histogram of destination area counts (Feb 2020 - Jan 2020)')