| Hosted by CoCalc | Download
Kernel: Python 3 (Ubuntu Linux)

Pint Python Library

Pint is a Python package to define, operate and manipulate physical quantities: the product of a numerical value and a unit of measurement. It allows arithmetic operations between them and conversions from and to different units.

http://pint.readthedocs.io/

import pint pint.__version__
'0.8.1'
ureg = pint.UnitRegistry() 3 * ureg.meter + 4 * ureg.cm
3.04 meter
import numpy as np np.array([3, 4]) * ureg.meter + np.array([4, 3]) * ureg.cm
(3.044.03)meter\begin{pmatrix}3.04 & 4.03\end{pmatrix} meter
Q_ = ureg.Quantity temp1 = Q_(25.4, ureg.degC) temp1.to('degF')
77.72000039999993 degF