Skip to main content

Quantities is designed to handle arithmetic and conversions of physical quantities, which have a magnitude, dimensionality specified by various units, and possibly an uncertainty. See the tutorial for examples. Quantities builds on the popular numpy library and is designed to work with numpy ufuncs, many of which are already supported. Quantities is actively developed, and while the current features and API are stable, test coverage is incomplete so the package is not suggested for mission-critical applications.

pypi version Build status

A Python package for handling physical quantities. The source code and issue tracker are hosted on GitHub:

https://www.github.com/python-quantities/python-quantities

Download

Get the latest version of quantities from https://pypi.python.org/pypi/quantities/

To get the Git version do:

$ git clone git://github.com/python-quantities/python-quantities.git

Documentation and usage

You can find the official documentation at:

http://python-quantities.readthedocs.io/

Here is a simple example:

>>> import quantities as pq
>>> distance = 42*pq.metre
>>> time = 17*pq.second
>>> velocity = distance / time
>>> "%.3f %s" % (velocity.magnitude, velocity.dimensionality)
'2.471 m/s'
>>> velocity + 3
Traceback (most recent call last):
  ...
ValueError: Unable to convert between units of "dimensionless" and "m/s"

Installation

To install quantities itself, simply run:

$ pip install quantities

Tests

To execute all tests, install pytest:

$ python -m pip install pytest

And run:

$ pytest

in the current directory. The master branch is automatically tested by GitHub Actions.

Author

quantities was originally written by Darren Dale, and has received contributions from many people.

License

Quantities only uses BSD compatible code. See the Open Source Initiative licenses page for details on individual licenses.

See doc/user/license.rst for further details on the license of quantities

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quantities-0.16.3.tar.gz (100.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quantities-0.16.3-py3-none-any.whl (103.8 kB view details)

Uploaded Python 3

File details

Details for the file quantities-0.16.3.tar.gz.

File metadata

  • Download URL: quantities-0.16.3.tar.gz
  • Upload date:
  • Size: 100.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for quantities-0.16.3.tar.gz
Algorithm Hash digest
SHA256 a8dfa87d0d5db645e3db0ad4026e2fef92d068cb618aeceee0d239fac8fbbc5b
MD5 8c77fdb036d2d0f909756e896f8111e0
BLAKE2b-256 f21f04a5078af52b1587842eccd57e805f776919ab68d9a295efa061eb8c2f58

See more details on using hashes here.

File details

Details for the file quantities-0.16.3-py3-none-any.whl.

File metadata

  • Download URL: quantities-0.16.3-py3-none-any.whl
  • Upload date:
  • Size: 103.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for quantities-0.16.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ed82d948c44acca080db1d5549b739e8ccf6b16d7d2a4b584f8162865f1558dc
MD5 4f7ec4534d1706402f1fda35e52245e5
BLAKE2b-256 bf58ce901c28141e422a2377db761be4c59b20d1daada8f873155da089e84427

See more details on using hashes here.

Release history Release notifications | RSS feed

0.16.4

2 files

This release

0.16.3 This release

2 files

0.16.2

2 files

0.16.1

2 files

0.16.0

2 files

0.15.0

2 files

0.14.1

2 files

0.14.0

2 files

0.13.0

1 file

0.12.5

1 file

0.12.4

1 file

0.12.3

1 file

0.12.2

1 file

0.12.1

1 file

0.12.0

1 file

0.11.1

1 file

0.11.0

1 file

0.10.1

2 files

0.10.0

2 files

0.9.0

8 files

0.8.0

2 files

0.7.0

5 files

0.6.0

4 files

0.5.2

4 files

0.5.1

3 files

0.5.0

3 files

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