Rezone.rezone#
- static Rezone.rezone(df, lookup, df_col, lookup_old='old', lookup_new='new', split_col='splitting_factor', rezone_cols='trips')[source]#
Rezones a dataframe with a lookup dataframe, using splitting factors.
- Parameters:
df (pandas.DataFrame) – The matrix to be rezoned.
lookup (pandas.DataFrame) – The lookup tables to do the rezoning.
df_col (str) – The column to be replaced with a new zone system.
lookup_old (str, optional) – The column that contains the current zone system (present in df). Default ‘old’
lookup_new (str, optional) – The column that contains the new zone system. Default ‘new’.
split_col (str, optional) – The column that contains the splitting factors. Default ‘splitting_factor’.
rezone_cols (str or list-like, optional, default "trips") – The column(s) which should be multiplied by the splitCol during rezoning.
- Returns:
merged (DataFrame) – Rezoned input dataframe.
missing (DataFrame) – Rows containing zones not present in the lookup dataframe