add_unit
- caqtus.analysis.units.add_unit( ) Series
Add a unit to a series, if it is not None.
- Parameters:
series – the series to which the unit should be added.
unit – the unit to add. If None, the series is returned unchanged.
- Returns:
A new series with the unit added. If the unit is None, the series is returned unchanged and has the same dtype. If the unit is not None, the series is returned with a quantity dtype having the unit as a categorical and the magnitude with the same dtype as the original series.