Skip to main content

Round nutritional values for federal compliance.

Project description status build PyPI Downloads


A lightweight Python package to round nutritional values for federal compliance with FDA and NDC guidelines.

>>> print([total_carb('0.8g'), vitamin_k('125.5 mcg')])
['less than 1g', '126mcg']
>>> print(total_carb('0.8 g', minimal=True))


Install the package:

pip install round-nutrition

Import the module:

from round_nutrition import * # or specific functions


All subnutrient functions take in an int or str argument for quantity.

         General                   Vitamin                  Mineral                  Other
      added_sugars*           biotin                      calcium                   choline
      calories                folate                      chromium
      cholesterol*            niacin                      copper
      dietary_fiber*          pantothenic_acid            iodine
      insoluble_fiber*        riboflavin                  iron
      mono_fat                thiamine                    magnesium
      other_carb*             vitamin_a                   manganese
      poly_fat                vitamin_b12                 molybdenum
      potassium               vitamin_b6                  potassium
      protein*                vitamin_c                   phosphorus
      sat_fat                 vitamin_d                   selenium
      sodium                  vitamin_e                   zinc
      soluble_fiber*          vitamin_k

⚠️ As of 1.1.x all functions have been made external with no need for object instantiation.

*Some functions have a boolean parameter of minimal to opt for a cleaner user interface implementation. By default, its argument is set to False.


Make a pull request for any idea/fix you have, or make an issue if you're lazy.



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

round-nutrition-1.1.0.tar.gz (5.9 kB view hashes)

Uploaded Source

Built Distribution

round_nutrition-1.1.0-py3-none-any.whl (6.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page