Skip to main content

FoodDataCentral

img

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_KEY".

apikey = "DEMO_KEY"  # Replace with a real key!  "DEMO_KEY" will be slow...

Looking up foods

I've written a little module fooddatacentral with the methods

  • search
  • nutrients
  • units

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")

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)

FDC Ingredients

We can also look up the ingredients for many foods (specifically Survey Foods) in the FDC:

fdc.ingredients(apikey,id)

Metadata

Release files for fooddatacentral 1.0.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fooddatacentral 1.0.13
File Size Uploaded
fooddatacentral-1.0.13.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fooddatacentral 1.0.13
File Interpreter ABI Platform
fooddatacentral-1.0.13-py3-none-any.whl Python 3 none any Details

Total release size: 8.3 kB

Release files / fooddatacentral-1.0.13.tar.gz

Download URL fooddatacentral-1.0.13.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9e6e3c9fe9090d222be430d8947840876114ae90b74158062d076f6ffbcdd0e5
BLAKE2b-256 checksum
How to use checksums
5eacf73efa58e05329b4aec24b1efd2e48ba5589901beb9e8cbe40c5699f7518
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / fooddatacentral-1.0.13-py3-none-any.whl

Download URL fooddatacentral-1.0.13-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31ea8e74715ae43995ff0ac26d379d5e485bcd1caf2280750926442c781cac7f
BLAKE2b-256 checksum
How to use checksums
bfa8f3266567ad07315ed49cd193cd44be0715b2357a130947e1012c3a227f19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.13 This release

2 release files

1.0.12

2 release files

1.0.11

2 release files

1.0.10

1 release file

1.0.9

2 release files

1.0.8

1 release file

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