Skip to main content

Rounds iterables (arrays, lists, sets, etc) while maintaining the sum of the initial array.

Project description

Iteround: Sum-safe Rounding for Iterables

.. image:: :target:

Iteround is an organic (standard library) sum-safe rounding library for Python iterables (lists, tuples, dicts).

.. image::

Example Code:

.. code-block:: python

>>> import iteround
>>> data = {'foo': 60.19012964572332,
            'bar': 15.428802458406679,
            'baz': 24.381067895870007}
>>> sum(data.values())
>>> rounded = iteround.saferound(data, 0)
>>> rounded
{'foo': 60.0,
 'bar': 16.0,
 'baz': 24.0}
>>> sum(rounded.values())

Feature Support

Iteround definitely supports at least these iterables.

  • list
  • tuple
  • dict

Iteround officially supports Python 2.7 & 3.4–3.6.


To install Iteround, use pipenv <>_ (or pip, of course):

.. code-block:: bash

$ pipenv install iteround


Documentation beyond this readme will be available soon.

How to Contribute

#. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. #. Fork the repository_ on GitHub to start making your changes to the master branch (or branch off of it). #. Write a test which shows that the bug was fixed or that the feature works as expected. #. Send a pull request. Make sure to add yourself to AUTHORS_.

.. _the repository: .. _AUTHORS:

Project details

Download files

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

Source Distribution

iteround-1.0.0.tar.gz (4.3 kB view hashes)

Uploaded source

Built Distribution

iteround-1.0.0-py3-none-any.whl (5.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page