CoolFace
Datasetpublic

amitbenavraham/usda-nutrition-eda

๐Ÿฅ— USDA FoodData Central โ€“ Nutrition EDA Overview This project presents an end-to-end Exploratory Data Analysis (EDA) of nutritional data from the USDA FoodData Central database. The goal is to uncover patterns in food nutrition, compare food categories, and explore relationships between key nutritional features. Source: omid5/usda-fdc-foods-cleaned Original size: 501,887 rows ร— 22 columns Final clean size: 345,226 rows ร— 11 numeric features Target Variable:โ€ฆ See the full description on the dataset page: https://huggingface.co/datasets/amitbenavraham/usda-nutrition-eda.

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes23downloads
Dataset Card

๐Ÿฅ— USDA FoodData Central โ€“ Nutrition EDA

<video src="https://huggingface.co/datasets/amitbenavraham/usda-nutrition-eda/resolve/main/AmitEda.mp4" controls="controls" style="max-width: 720px;"></video>

Overview

This project presents an end-to-end Exploratory Data Analysis (EDA) of nutritional data from the USDA FoodData Central database. The goal is to uncover patterns in food nutrition, compare food categories, and explore relationships between key nutritional features.

  • โ€”Source: omid5/usda-fdc-foods-cleaned
  • โ€”Original size: 501,887 rows ร— 22 columns
  • โ€”Final clean size: 345,226 rows ร— 11 numeric features
  • โ€”Target Variable: data_type (brandedfood / srlegacy_food) ---

Dataset Description

  • โ€”Source: omid5/usda-fdc-foods-cleaned
  • โ€”Original size: 501,887 rows ร— 22 columns
  • โ€”Final clean size: 345,226 rows ร— 11 numeric features
  • โ€”Target Variable: data_type (brandedfood / srlegacy_food)

Features

ColumnDescription
EnergyCalories per 100g (kcal)
ProteinProtein content (g)
Total lipid (fat)Total fat (g)
Fatty acids, total saturatedSaturated fat (g)
Fatty acids, total transTrans fat (g)
Carbohydrate, by differenceCarbohydrates (g)
Fiber, total dietaryDietary fiber (g)
CholesterolCholesterol (mg)
Sodium, NaSodium (mg)
Calcium, CaCalcium (mg)
Iron, FeIron (mg)

Data Cleaning

Steps performed:

  • โ€”Dropped irrelevant non-numeric columns (fdc_id, ingredients, serving info)
  • โ€”Checked for duplicates โ†’ 0 found
  • โ€”Dropped columns with more than 50% missing values (Caffeine, Vitamin D, Potassium)
  • โ€”Dropped remaining rows with any missing values
  • โ€”Removed foundation_food category (only 1 row)
  • โ€”Final clean dataset: 345,226 rows ร— 11 numeric columns

Outlier Detection

  • โ€”Used box plots and the IQR method across all 11 numeric columns
  • โ€”Outliers found in every column โ€” highest in Cholesterol (11.53%), Calcium (7.59%), Fiber (6.83%)
  • โ€”Decision: retained all outliers โ€” in food data, extreme values are completely legitimate (e.g., pure oil = very high fat, table salt = very high sodium)

Research Question

Can we predict the food category (branded vs. SR legacy) based on its nutritional profile?


Visualizations & Key Findings

Q1: What is the average calorie content by food category?

Finding: SR Legacy foods average 518.6 kcal vs. 291.6 kcal for branded foods. SR Legacy includes calorie-dense whole foods like oils and nuts, while branded foods include a much wider variety including low-calorie options like diet drinks and salads.

Screenshot 2026-04-12 at 0.38.13

Q2: How is protein content distributed across food categories?

Finding: SR Legacy foods show a wider protein distribution (median ~10g, range 0โ€“48g) compared to branded foods (median ~6g, range 0โ€“23g). SR Legacy includes more protein-dense whole foods like meats, fish, and legumes.

Screenshot 2026-04-12 at 0.39.03

Q3: Is there a relationship between fat and calorie content?

Finding: Clear positive relationship between fat and calories โ€” as fat increases, calories increase. Fat contains 9 kcal/g vs. 4 kcal/g for protein and carbohydrates. Both food categories follow the same trend.

Screenshot 2026-04-12 at 0.40.05

Q4: Which nutritional values are most correlated with each other?

Key correlations:

  • โ€”Total Fat โ†” Energy: 0.72 (strongest)
  • โ€”Saturated Fat โ†” Total Fat: 0.70
  • โ€”Carbohydrate โ†” Energy: 0.66
  • โ€”Saturated Fat โ†” Energy: 0.50
  • โ€”Fiber โ†” Carbohydrate: 0.38
  • โ€”Sodium โ†” everything: ~0.00 (no correlation)

Screenshot 2026-04-12 at 0.40.28


Summary & Conclusions

  • โ€”SR Legacy foods are significantly more caloric than branded foods (518 vs. 291 kcal)
  • โ€”Fat content is the strongest predictor of calories (correlation = 0.72)
  • โ€”SR Legacy foods show higher and wider protein distribution
  • โ€”Sodium is completely independent of all other nutritional features
  • โ€”Nutritional profiles differ meaningfully between commercial branded products and USDA reference foods, supporting our research question

Tools & Technologies

  • โ€”Python (Pandas, NumPy)
  • โ€”Data Visualization (Matplotlib, Seaborn)
  • โ€”Google Colab
  • โ€”HuggingFace Datasets

Author

Amit Ben-Avraham