unitc
Physical measurement units conversation module for Python 3.
- unitc.unit_conversion(value, from_unit=None, to_unit=None)
Measurement units conversion.
Using this function, value from_unit is converted to new_value to_unit. If one of the units is not provided, it is assumed to be an SI unit. If no units are provided, the same value is returned.
- Parameters
value (float, list, str or numpy.array) – Value(s) to be converted. If given as a string, a unit can be specified.
from_unit (str, optional) – Unit of the input value(s).
to_unit (str, optional) – Unit the value(s) are converted to.
- Returns
Converted value(s).
- Return type
float or numpy.ndarray
- Raises
ValueError – If given units are inconsistent, unknown or not compatible.
NotImplementedError – Not implemented features.