Vulnerability Index Example
This example demonstrates how to generate and use time-based vulnerability indices.
from verus.data import TimeWindowGenerator
import pandas as pd
# Create time window generator (defaults to the current week; pass
# reference_date="YYYY-MM-DD" to pin to a specific Monday)
tw_generator = TimeWindowGenerator(verbose=True)
# Generate time windows based on typical opening hours
time_windows = tw_generator.generate_from_schedule()
# Print available categories
print(f"Generated time windows for categories: {list(time_windows.keys())}")
# Examine vulnerability indices for restaurants at different times
school_hours = time_windows["school"]
print("\School vulnerability indices throughout the day:")
print(school_hours[["ts", "te", "vi"]].head(24))
Follow this example in the project’s notebooks folder.