with_columns_expressed_in_units

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

Compute the magnitude of columns in a dataframe to given units.

Parameters:
  • dataframe – the dataframe to convert.

  • column_units – a mapping from column names to units.

Returns:

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