Skip to main content

Python module to perform conversions between measurement units.

Usage example

>>> from unitc import unit_conversion
# Convert 1 kg to pounds
>>> unit_conversion(1, 'kg', 'lb')
2.204623
>>> unit_conversion(1, from_unit='kg', to_unit='lb')
2.204623

# If the conversion is done to or from SI units, they don't need to be specified explicitely
>>> unit_conversion(1, 'ft')  # Converts 1 ft to m
0.3047999902464003
>>> unit_conversion(1, to_unit='HP') # Converts 1 W to horse power (HP)
0.001341022

# Unit conversion works also with lists and arrays
>>> a = [1, 2, 3, 4, 5]
>>> unit_conversion(a, 'kPa', 'lbf/ft²')
array([ 20.88543648,  41.77087296,  62.65630944,  83.54174592, 104.42718239])

>>> b = np.array([2, 5, 8, 7])
>>> unit_conversion(b, 'kt', 'm/s')
array([1.02888947, 2.57222367, 4.11555787, 3.60111313])

# Input units can be specified in the input value as a string
>>> unit_conversion('4 g/cm³', to_unit='lb/in³')
0.14450917891460638

Metadata

Release files for unitc 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unitc 0.0.6
File Size Uploaded Provenance
unitc-0.0.6.tar.gz 5.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for unitc 0.0.6
File Interpreter ABI Platform
unitc-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / unitc-0.0.6.tar.gz

Download URL unitc-0.0.6.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
61cd66e9451fce9f06b5501563ed8c8e8a34e497d911ab1b33b448dd2c000276
BLAKE2b-256 checksum
How to use checksums
8e5c7fd542074556ee1935a7842774f48bfdef9873acc2947efc2ef3cffff304
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.2

Release files / unitc-0.0.6-py3-none-any.whl

Download URL unitc-0.0.6-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
58022a414dc19d2c6e17d2d401ff9e0c7a1ef0336b67f182fc6b7d1974670345
BLAKE2b-256 checksum
How to use checksums
277728191e0e60b7620071d7745c4893bf6bb0becfa0a2c71821a19e448f2bee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.2

Security for unitc 0.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page