import dascore as dc
# Create unit from string
= dc.get_unit('m/s')
unit assert str(unit) == 'm / s'
# Create unit from existing quantity
= dc.get_quantity('10 Hz')
quantity = dc.get_unit(quantity.units)
unit assert str(unit) == 'Hz'
get_unit
get_unit(
value ,
)-> ‘Unit’
Convert a value to a pint unit.
Usually quantities, generated with get_quantity
, are easy to work with.