Compare Sizes
Register
English Français Español

Python units/quantities packages

5
There are far too many different packages for unit conversion / quantities calculations in Python. Developers should cooperate on one package instead of fragmenting development across many different ones. This documents which features are supported by each package.
Link
WebseitePyPI DLs/monthGitHub StarsUsed byBuilt-in unitsBuilt-in constantsArbitrary prefixesnp scalar arraynp object arrayDecimalFractionUncertaintiesstringabsolute °CdBSyntaxBemerkungen
scipy.constantsscipy.org/...167,3857,087181,360Ja 50Ja 400 in CODATANein- no unit objects- no unit objects- no unit objects- no unit objects- no unit objects- no unit objectsNeinNeinconstants.c == 299792458.0Just tables of numerical constants; unit-aware calculations not supported. scipy.constants.physical_constants specifies units as strings and uncertainties. Could be used to supply other packages with coefficients.
sympy.physics.unitssympy.org/...55,4246,92418,324Ja 200?Ja- u.mega*u.meter but not u.megameterNeinJa array([1, 2, 3])*u.m- converts to sympy- converts to sympycm = u.m/100
astropy.unitsastropy.org/...11,3582,43513,777JaJaNeinJa-JaJa15.1 * u.meter / (32.0 * u.second)
Pintgithub.com/...35,7461,1281,579JaJaJa Mm, GV, etc.Ja array([1,2,3])*ureg.m or ureg.m*array([1,2,3])Nein ValueErrorJaJaJa built-inJaJaNeinV = 1*ureg.dm**3
unytreadthedocs.io/...24329Ja 101Ja 33Ja km4*m + 3*cm - 5*ft + 6*yard
Quantitiesreadthedocs.org3,917147231Ja array([1,2,3]) * pq.JNein
Unitsbitbucket.org/...1,376
numericalunitspython.org/...44569Overflow issues, random set of units = not deterministic, need to do calculations twice to confirm they are being done correctly
SciMath Unitsreadthedocs.org/...43036Ja built-in
Buckinghamgithub.com/...361200Ja 53NeinJaV = Number(1,dims='decimeter^3')Single file
Unumbitbucket.org/...334
natugithub.io/...315JaJa 40JaJa m*array([1, 2, 3])Ja array([1, 2, 3])*mNeinNeinJaNeinJaJaV = 1*dm**3weird format for dB, Hz != 1/s, "pre-release state"
misugithub.com/...308110
Magnitudejuanreyero.com/...2381631JaJaJa
udunitspygithub.com/...18820Python wrapper for UDUNITS2
scinumtools.unitsgithub.com/...4715JaJaJaJaJaJaJaJaJaJa K, Cel, degF, degRJa dB, Np, dBm, dBmW, ... (both B and dB)quant(3, 'J').to('kg*m2/s2')
quant([5.9e-4, 5.2e+5], 'J*s-1').to('W')
33*unit('kg'), const('c')
3*unit.m/unit.s
No registries needed like for Pint. Documentation is available here: github.io/...
DimPycam.ac.uk/...0
Scalarrussp.us/...0
ScientificPython PhysicalQuantitiescnrs-orleans.fr/...0
Embed
this is an excerpt
Frameworks
English
Public
Public
2024-06-01 10:32:47
View changes
Manage backups

User reviews and comments

  • LuisFuture on 2023-12-21 12:20:30

    Great comparison on Python units and quantities packages! For those looking to implement such tools in a project, partnering with a top Python team can make a huge difference. Check out Attract Group, recently hailed as a leading Python and Django firm by Techreviewer, check top python and django company in 2021. Their expertise could be invaluable for your project's success.