with_units_added_to_columns

caqtus.analysis.units.with_units_added_to_columns(
dataframe: DataFrame,
column_units: Mapping[str, Unit | None],
) DataFrame

Add units to columns in a dataframe.

Parameters:
  • dataframe – the dataframe to convert.

  • column_units – a mapping from column names to units. If the unit is None,

  • unchanged. (the column is returned)

Returns:

A new dataframe with the same columns as the original dataframe, but with all columns containing the magnitude of the original columns with the requested units.