pandas_multi_vector_zone_translation#

translation.pandas_multi_vector_zone_translation(vector, translation, translation_from_col, translation_to_col, translation_factors_col, translation_dtype=None, check_totals=True)#

Efficiently translate a multi-column pandas vector between index systems.

Internally, checks and converts the pandas inputs into numpy arrays and calls numpy_vector_zone_translation(). The final output is then converted back into a pandas Series, using the same format as the input.

Parameters:
  • vector (DataFrame) – The vector to translate. The index must be the values to be translated. Any further segmentation data (i.e. data which should not be factored or translated) must be either in the columns or part of a MultiIndex. If part of a MultiIndex, the level of the MultiIndex to translate on must be named share a name with translation_from_col.

  • translation (DataFrame) – A pandas DataFrame defining the weights to translate use when translating. Needs to contain columns: translation_from_col, translation_to_col, translation_factors_col.

  • translation_from_col (str) – The name of the column in translation containing the current index values of vector.

  • translation_to_col (str) – The name of the column in translation containing the desired output index values. This will define the output index format.

  • translation_factors_col (str) – The name of the column in translation containing the translation weights between translation_from_col and translation_to_col. Where zone pairs do not exist, they will be infilled with translate_infill.

  • translation_dtype (dtype | None) – The numpy datatype to use to do the translation. If None, then the dtype of the vector is used. Where such high precision isn’t needed, a more memory and time efficient data type can be used.

  • check_totals (bool) – Whether to check that the input and output matrices sum to the same total.

Returns:

vector, translated into to_zone system.

Return type:

translated_vector