Commit 1cd865bf authored by Grace Orowo Kagho's avatar Grace Orowo Kagho
Browse files

create distance distribution for the weekend for use in secondary activities

parent 46eea1c7
......@@ -5,6 +5,7 @@ import pandas as pd
def configure(context):
context.stage("data.microcensus.persons")
context.stage("data.microcensus.trips")
context.config("weekend_scenario", False)
def calculate_bounds(values, bin_size):
......@@ -37,6 +38,12 @@ def execute(context):
# Prepare data
df_persons = context.stage("data.microcensus.persons")[["person_id", "person_weight"]].rename(
columns={"person_weight": "weight"})
#distance distribution for weekend scenario
is_weekend_scenario = context.config("weekend_scenario")
if is_weekend_scenario:
df_persons = df_persons[df_persons["weekend"]]
df_trips = context.stage("data.microcensus.trips")[["person_id", "trip_id", "mode", "crowfly_distance",
"departure_time", "arrival_time", "purpose"]]
df_trips = pd.merge(df_trips, df_persons[["person_id", "weight"]], on="person_id")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment