# FoodDataCentral
[](https://zenodo.org/badge/latestdoi/238808020)
The USDA maintains a database of nutritional information, where
different kinds of food are identified by an FDC number. They do
not provide any data on prices.
To look up nutritional information, use api provided by the USDA at
<https://fdc.nal.usda.gov/>. You should sign up for a
free api key (see directions on page), then add that key here in
place of “DEMO<sub>KEY</sub>”.
apikey = "DEMO_KEY" # Replace with a real key! "DEMO_KEY" will be slow...
<a id="org0a001b6"></a>
# Looking up foods
I’ve written a little module `fooddatacentral` with the methods
- `search`
- `nutrients`
- `units`
<a id="org24e646d"></a>
# FDC Search
Here’s a little code to help look up FDC codes for foods of
different descriptions.
import fooddatacentral as fdc
fdc.search(apikey,"crunchy peanut butter")
<a id="org4e9bac2"></a>
# FDC Nutrients
Once we know the `fdc_id` of a particular food we can look up a
variety of information on it. We start with nutrients
id = # Put an FDC ID HERE!
fdc.nutrients(apikey,fdc_id=id)
<a id="org7462d48"></a>
# FDC Ingredients
We can also look up the ingredients for many foods (specifically Survey Foods) in the FDC:
fdc.ingredients(apikey,id)
Raw data
{
"_id": null,
"home_page": "https://github.com/ligon/fooddatacentral",
"name": "fooddatacentral",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "USDA,FDC",
"author": "",
"author_email": "ligon@berkeley.edu",
"download_url": "",
"platform": null,
"description": "# FoodDataCentral\n[](https://zenodo.org/badge/latestdoi/238808020)\n\nThe USDA maintains a database of nutritional information, where\ndifferent kinds of food are identified by an FDC number. They do\nnot provide any data on prices.\n\nTo look up nutritional information, use api provided by the USDA at\n<https://fdc.nal.usda.gov/>. You should sign up for a\nfree api key (see directions on page), then add that key here in\nplace of “DEMO<sub>KEY</sub>”.\n\n apikey = \"DEMO_KEY\" # Replace with a real key! \"DEMO_KEY\" will be slow...\n\n\n<a id=\"org0a001b6\"></a>\n\n# Looking up foods\n\nI’ve written a little module `fooddatacentral` with the methods\n\n- `search`\n- `nutrients`\n- `units`\n\n\n<a id=\"org24e646d\"></a>\n\n# FDC Search\n\nHere’s a little code to help look up FDC codes for foods of\ndifferent descriptions.\n\n import fooddatacentral as fdc\n \n fdc.search(apikey,\"crunchy peanut butter\")\n\n\n<a id=\"org4e9bac2\"></a>\n\n# FDC Nutrients\n\nOnce we know the `fdc_id` of a particular food we can look up a\nvariety of information on it. We start with nutrients\n\n id = # Put an FDC ID HERE!\n fdc.nutrients(apikey,fdc_id=id)\n\n\n<a id=\"org7462d48\"></a>\n\n# FDC Ingredients\n\nWe can also look up the ingredients for many foods (specifically Survey Foods) in the FDC:\n\n \n fdc.ingredients(apikey,id)\n\n",
"bugtrack_url": null,
"license": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0. http://creativecommons.org/licenses/by-nc-sa/4.0/",
"summary": "Python module to obtain information from the USDA's Food Data Central data project.",
"version": "1.0.10",
"project_urls": {
"Homepage": "https://github.com/ligon/fooddatacentral"
},
"split_keywords": [
"usda",
"fdc"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "36fad2ea5dd742c1d0dbb555b6421ea8fdb379fdf637146a799c3261944611f0",
"md5": "50f74c6df313bae568036be2975c33a8",
"sha256": "1bef6c39bad59a95be193c072b55b1663db7f790540390206b054de1860cce12"
},
"downloads": -1,
"filename": "fooddatacentral-1.0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "50f74c6df313bae568036be2975c33a8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6776,
"upload_time": "2024-01-14T22:15:01",
"upload_time_iso_8601": "2024-01-14T22:15:01.094088Z",
"url": "https://files.pythonhosted.org/packages/36/fa/d2ea5dd742c1d0dbb555b6421ea8fdb379fdf637146a799c3261944611f0/fooddatacentral-1.0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-14 22:15:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ligon",
"github_project": "fooddatacentral",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "fooddatacentral"
}