PhiFactors.from_csv#

classmethod PhiFactors.from_csv(path, segment_columns, *, data_column='trips.est', period_filter=None, period_columns=('period.fr', 'period'), translate_segments=None, segment_filters=None)[source]#

Load phi factors from a CSV.

Parameters:
  • path (Path) – Path to the CSV.

  • segment_columns (dict[str, str]) – Names of CSV columns (keys) and their corresponding segment (values).

  • data_column (str) – Name of column containing trips data, by default “trips.est”.

  • period_filter (Collection[int] | None) – Optional list of time periods to filter down to.

  • period_columns (tuple[str, str]) – Name of columns containing time periods from and to home, by default (“period.fr”, “period”).

  • translate_segments (dict[str, str] | None) – Mapping of any segments that need translating, translates from keys to values. All must be names of segments not columns.

  • segment_filters (Mapping[str, Sequence[int]] | None) – Optional segment filters, for any additional segmentation provided.

Return type:

PhiFactors