load_occupancies#
- caf.mat.direction.factors.load_occupancies(path, segment_columns, *, driver_column='driver', total_column='total', occupancy_column=None, translate_segments=None)[source]#
Load occupancy factors from a CSV.
- Parameters:
path (Path) – Path to CSV.
segment_columns (dict[str, str]) – Mapping from column names (keys) to segments (values).
driver_column (str | None) – Name of column containing number of drivers (default “driver”), used for calculating occupancies. Set to None if providing precalculated occupancy_column.
total_column (str | None) – Name of column containing total people (default “total”), used for calculating occupancies. Set to None if providing precalculated occupancy_column.
occupancy_column (str | None) – Name of column containing pre-calculated occupancies, required if total or driver columns aren’t provided.
translate_segments (dict[str, str] | None) – Mapping to translate segments given (keys) to new segments (values) for output occupancies.
- Returns:
Occupancies data as a DVector.
- Return type:
caf.base.DVector
- Raises:
ValueError – If duplicates are found in the segmentation (often the case when translating) and total_column or driver_column isn’t provided to recalculate the occupancies.