{ "info": { "author": "Calvin DeBoer", "author_email": "cgdeboer@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3" ], "description": "Iteround: Sum-safe Rounding for Iterables\n========================================\n.. image:: https://travis-ci.org/cgdeboer/iteround.svg?branch=master\n :target: https://travis-ci.org/cgdeboer/iteround\n\n.. image:: https://img.shields.io/pypi/v/iteround.svg\n :target: https://pypi.org/project/iteround/\n\nIteround is an organic (standard library) sum-safe rounding library for Python\niterables (lists, tuples, dicts).\n\n.. image:: https://raw.githubusercontent.com/cgdeboer/iteround/master/docs/iteround.png\n\n\nExample Code:\n\n.. code-block:: python\n\n >>> import iteround\n >>> data = {'foo': 60.19012964572332,\n 'bar': 15.428802458406679,\n 'baz': 24.381067895870007}\n >>> sum(data.values())\n 100.0\n >>> rounded = iteround.saferound(data, 0)\n >>> rounded\n {'foo': 60.0,\n 'bar': 16.0,\n 'baz': 24.0}m\n >>> sum(rounded.values())\n 100.0\n\nHow It Works\n---------------\nIteround provides a single method, called :code:`saferound` that takes the\nfollowing inputs:\n\niterable (list, dict, set, numpy.array, generator): list(y) of numbers\n If a dict is passed in, the values must be all floats.\n\nplaces (int): Places for rounding.\n Number of places each item in the set should be rounded to.\n\nstrategy (str, optional): The strategy used to clean up rounding errors\n 'difference', 'largest', 'smallest'. Defaults to 'difference'\n\n 'difference' seeks to minimize the sum of the array of the\n differences between the original value and the rounded value of\n each item in the iterable. It will adjust the items with the\n largest difference to preserve the sum. This is the default.\n\n 'largest' for any post rounding adjustments, sort the array by\n the largest values to smallest and adjust those first.\n\n 'smallest' for any post rounding adjustments, sort the array by\n the smallest values to largest, adjust the smaller ones first.\n\n Strategy strings are available as:\n :code:`iteround.DIFFERENCE`\n :code:`iteround.LARGEST`\n :code:`iteround.SMALLEST`\n\nIf 'dict' or 'tuple' are passed, result will be dict or tuple.\nAll other iterables (range, map, np.array, etc) will return\nlist.\n\n\n\nFeature Support\n---------------\n\nIteround definitely supports at least these iterables.\n\n- `list`\n- `tuple`\n- `dict`\n\n\nIteround officially supports Python 2.7 & 3.4\u20133.6.\n\nInstallation\n------------\n\nTo install Iteround, use `pipenv `_ (or pip, of course):\n\n.. code-block:: bash\n\n $ pipenv install iteround\n\nDocumentation\n-------------\n\nDocumentation beyond this readme will be available soon.\n\n\nHow to Contribute\n-----------------\n\n#. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.\n#. Fork `the repository`_ on GitHub to start making your changes to the **master** branch (or branch off of it).\n#. Write a test which shows that the bug was fixed or that the feature works as expected.\n#. Send a pull request. Make sure to add yourself to AUTHORS_.\n\n.. _`the repository`: https://github.com/requests/requests\n.. _AUTHORS: https://github.com/requests/requests/blob/master/AUTHORS.rst\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cgdeboer/iteround", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "iteround", "package_url": "https://pypi.org/project/iteround/", "platform": "", "project_url": "https://pypi.org/project/iteround/", "project_urls": { "Homepage": "https://github.com/cgdeboer/iteround" }, "release_url": "https://pypi.org/project/iteround/1.0.2/", "requires_dist": null, "requires_python": "", "summary": "Rounds iterables (arrays, lists, sets, etc) while maintaining the sum of the initial array.", "version": "1.0.2" }, "last_serial": 4073168, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "813b4bef8a2074b057cfc59e38017a7d", "sha256": "5b9ebd93edfda0f14d075863e55d8e10383984e942575bf87d7a48b958fe18b7" }, "downloads": -1, "filename": "iteround-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "813b4bef8a2074b057cfc59e38017a7d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5063, "upload_time": "2018-07-16T20:54:14", "url": "https://files.pythonhosted.org/packages/ab/d9/2ab3a5347710d05c535276bc3ec44c5a6c7042d8b543bf75a719b920b532/iteround-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cbb3e5646273a8eb92b1fc3a6f92e44e", "sha256": "5350a51eceb10ec3b630ff90040ba441a78e948286d18652076c449ea8b2da04" }, "downloads": -1, "filename": "iteround-1.0.0.tar.gz", "has_sig": false, "md5_digest": "cbb3e5646273a8eb92b1fc3a6f92e44e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4288, "upload_time": "2018-07-16T20:54:15", "url": "https://files.pythonhosted.org/packages/51/c7/b9190ba1a5cdb6b2c6cc7992ffbc521321328b5ab7b8a4f0d822537b5791/iteround-1.0.0.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "7937d1bfb0a593bf50d3cb1ab994f7b3", "sha256": "b280fe1b52818a5741ab6d6814ccba8b62ea8758acecb11765d8d77eb29a75fe" }, "downloads": -1, "filename": "iteround-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "7937d1bfb0a593bf50d3cb1ab994f7b3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5720, "upload_time": "2018-07-17T10:51:58", "url": "https://files.pythonhosted.org/packages/35/1d/ad1084701aa0e259a4e7f343ec32c94b2c799c377dadb2326133065275c9/iteround-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c7aebf02565147ec3adebf3c953930dc", "sha256": "68987aae7b9eb2de321a2a7a1f135f25893d21f6fa40cf14055af5fb1ed8ede0" }, "downloads": -1, "filename": "iteround-1.0.2.tar.gz", "has_sig": false, "md5_digest": "c7aebf02565147ec3adebf3c953930dc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4680, "upload_time": "2018-07-17T10:51:59", "url": "https://files.pythonhosted.org/packages/67/d2/57d11897fa12d0777e5183b6b5179b54b1665c33652073ad3a1cd674403e/iteround-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7937d1bfb0a593bf50d3cb1ab994f7b3", "sha256": "b280fe1b52818a5741ab6d6814ccba8b62ea8758acecb11765d8d77eb29a75fe" }, "downloads": -1, "filename": "iteround-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "7937d1bfb0a593bf50d3cb1ab994f7b3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5720, "upload_time": "2018-07-17T10:51:58", "url": "https://files.pythonhosted.org/packages/35/1d/ad1084701aa0e259a4e7f343ec32c94b2c799c377dadb2326133065275c9/iteround-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c7aebf02565147ec3adebf3c953930dc", "sha256": "68987aae7b9eb2de321a2a7a1f135f25893d21f6fa40cf14055af5fb1ed8ede0" }, "downloads": -1, "filename": "iteround-1.0.2.tar.gz", "has_sig": false, "md5_digest": "c7aebf02565147ec3adebf3c953930dc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4680, "upload_time": "2018-07-17T10:51:59", "url": "https://files.pythonhosted.org/packages/67/d2/57d11897fa12d0777e5183b6b5179b54b1665c33652073ad3a1cd674403e/iteround-1.0.2.tar.gz" } ] }