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
tw_generator = TimeWindowGenerator(
reference_date="2023-11-06", # A Monday
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.