Best Before/After Workout Food¶

Goal: Find various food options that are beneficial to consume before or after the workout¶

1. Describes and motivates a real-world problem¶

  • Real-world Problem: The food suggestions for certain timing of the day (before/after workout) provided on the internet are limited.
  • Description: My new year resolution is to eat and work out in healthy ways, so I often looked up some foods that are beneficial to eat before or after the workout. However, the kinds of foods provided on many websites were quite limited and repetitive, and some of them were hard to get or cook as a student living in a dormitory without a kitchen. Therefore, I thought it would be nice to use data science to find out other suitable alternatives based on the nutritional content of the foods that are already suggested on the internet. The result that would contian products and foods from various brands and franchise stores will give helpful insights to people who are interested in living a healthy life.
  • Citation (shows the food suggestions for before/after workout and the importance of food selection to maximize workout):
  1. “Food as Fuel Before, During and After Workouts.” www.heart.org, 24 Jan. 2023, www.heart.org/en/healthy-living/healthy-eating/eat-smart/nutrition-basics/food-as-fuel-before-during-and-after-workouts.
  2. “What to Eat Before and After a Workout.” WebMD, www.webmd.com/fitness-exercise/ss/slideshow-foods-for-workout.
  3. “Eating and Exercise: 5 Tips to Maximize Your Workouts.” Mayo Clinic, 18 Dec. 2021, www.mayoclinic.org/healthy-lifestyle/fitness/in-depth/exercise/art-20045506.
  4. Williams, Carolyn, PhD. “Ask a Dietitian: What Should I Eat Before a Workout?” Cooking Light, 18 Feb. 2022, www.cookinglight.com/eating-smart/what-to-eat-before-a-workout.

2. Dataset¶

In [1]:
import pandas as pd

# load dataset
df_food = pd.read_csv('food_nutrition.csv')

# show dataset 
df_food
Out[1]:
Name Food Group Calories Fat (g) Protein (g) Carbohydrate (g) Sugars (g) Fiber (g) Cholesterol (mg) Saturated Fats (g) Calcium (mg) Iron, Fe (mg) Magnesium (mg) Vitamin C (mg) Omega 3s (mg) Sodium (mg)
0 Pillsbury Golden Layer Buttermilk Biscuits Art... Baked Foods 307.0 13.24 5.88 41.18 5.88 1.2 0.0 2.941 NaN 2.12 NaN NaN NaN 1059.0
1 Pillsbury Cinnamon Rolls With Icing Refrigerat... Baked Foods 330.0 11.27 4.34 53.42 21.34 1.4 0.0 3.250 28.0 1.93 NaN 0.1 NaN 780.0
2 Kraft Foods Shake N Bake Original Recipe Coati... Baked Foods 377.0 3.70 6.10 79.80 NaN NaN NaN NaN NaN NaN NaN NaN NaN 2182.0
3 George Weston Bakeries Thomas English Muffins Baked Foods 232.0 1.80 8.00 46.00 NaN NaN NaN 0.308 180.0 1.40 NaN NaN 79.0 345.0
4 Waffles Buttermilk Frozen Ready-To-Heat Baked Foods 273.0 9.22 6.58 41.05 4.30 2.2 15.0 1.898 279.0 6.04 19.0 0.0 21.0 621.0
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
14159 Cheese As Ingredient In Sandwiches NaN 359.0 28.73 20.65 4.57 2.40 0.0 90.0 16.492 959.0 0.47 29.0 0.0 29.0 1064.0
14160 Breading Or Batter As Ingredient In Food NaN 201.0 1.39 6.32 39.64 0.68 1.6 19.0 0.336 47.0 2.57 14.0 0.0 3.0 246.0
14161 Wheat Bread As Ingredient In Sandwiches NaN 263.0 3.96 11.45 45.29 5.18 5.4 0.0 0.716 161.0 3.12 56.0 0.1 2.0 464.0
14162 Sauce As Ingredient In Hamburgers NaN 271.0 22.85 1.29 17.19 13.02 0.6 13.0 3.541 18.0 0.43 13.0 2.5 2.0 845.0
14163 Industrial Oil As Ingredient In Food NaN 892.0 100.00 0.00 0.00 0.00 0.0 0.0 32.672 0.0 0.04 0.0 0.0 1698.0 0.0

14164 rows × 16 columns

In [2]:
# create a data dictionary which explains the meaning of each feature present
feature_dict = {'Name': 'Name of food',
 'Food Group': 'Group of food (ex: fish, meats)',
 'Calories': 'Amount of calories in serving size of 100g',
 'Fat (g)': 'Amount of fat in grams in serving size of 100g',
 'Protein (g)': 'Amount of protein in grams in serving size of 100g',
 'Carbohydrate (g)': 'Amount of carbohydrate in grams in serving size of 100g',
 'Sugars (g)': 'Amount of sugars in grams in serving size of 100g',
 'Fiber (g)': 'Amount of fiber in grams in serving size of 100g',
 'Cholesterol (mg)': 'Amount of cholesterol in milligrams in serving size of 100g',
 'Saturated Fats (g)': 'Amount of saturated fats in grams in serving size of 100g',
 'Calcium (mg)': 'Amount of calcium in milligrams in serving size of 100g',
 'Iron, Fe (mg)': 'Amount of iron in milligrams in serving size of 100g',
 'Magnesium (mg)': 'Amount of magnesium in milligrams in serving size of 100g',
 'Vitamin C (mg)': 'Amount of vitamin C in milligrams in serving size of 100g',
 'Omega 3s (mg)': 'Amount of omega 3s in milligrams in serving size of 100g',
 'Sodium (mg)': 'Amount of sodium in milligrams in serving size of 100g'}

feature_dict
Out[2]:
{'Name': 'Name of food',
 'Food Group': 'Group of food (ex: fish, meats)',
 'Calories': 'Amount of calories in serving size of 100g',
 'Fat (g)': 'Amount of fat in grams in serving size of 100g',
 'Protein (g)': 'Amount of protein in grams in serving size of 100g',
 'Carbohydrate (g)': 'Amount of carbohydrate in grams in serving size of 100g',
 'Sugars (g)': 'Amount of sugars in grams in serving size of 100g',
 'Fiber (g)': 'Amount of fiber in grams in serving size of 100g',
 'Cholesterol (mg)': 'Amount of cholesterol in milligrams in serving size of 100g',
 'Saturated Fats (g)': 'Amount of saturated fats in grams in serving size of 100g',
 'Calcium (mg)': 'Amount of calcium in milligrams in serving size of 100g',
 'Iron, Fe (mg)': 'Amount of iron in milligrams in serving size of 100g',
 'Magnesium (mg)': 'Amount of magnesium in milligrams in serving size of 100g',
 'Vitamin C (mg)': 'Amount of vitamin C in milligrams in serving size of 100g',
 'Omega 3s (mg)': 'Amount of omega 3s in milligrams in serving size of 100g',
 'Sodium (mg)': 'Amount of sodium in milligrams in serving size of 100g'}
In [3]:
# see what food groups are in the dataset
df_food['Food Group'].unique()
Out[3]:
array(['Baked Foods', 'Snacks', 'Sweets', 'Vegetables', 'American Indian',
       'Restaurant Foods', 'Beverages', 'Fats and Oils', 'Meats',
       'Dairy and Egg Products', 'Baby Foods', 'Breakfast Cereals',
       'Soups and Sauces', 'Beans and Lentils', 'Fish', 'Fruits', nan,
       'Grains and Pasta', 'Nuts and Seeds', 'Prepared Meals',
       'Fast Foods', 'Spices and Herbs', 'Dairy and Egg Products '],
      dtype=object)
  • Demonstrate this data is sufficient: Data contains the nutrition information about 14164 foods, and there over 20 food groups in the dataset. Also, the dataset provides the nutrition information for both brand-name product and general food without brand-name. Therefore, since the dataset that we should get the list of foods from shows the variety on food groups and food brand within over 14000 foods, this data is sufficient to make progress on my real-world problem described above.
  • Description on Dataset: The dataset is acquired from Myfooddata website, and the website acquired the nutrition data from 'USDA(United States Department of Agriculture) Food Data Central'. The dataset originally contained nutrition facts for over 100 nutrition for every food, but I deleted some nutrition features based on the importance of the nutrition and the number of null in the feature. (I determined the importance of nutrition based on the article written by Hillcrest Hospital and the citation will be provided below.)
  • citation:
  1. dataset: “Nutrition Facts Database Spreadsheet.” Myfooddata, tools.myfooddata.com/nutrition-facts-database-spreadsheet.php.
  2. nutrition importance: “When It Comes to Reading Food Labels, What’s Most Important?” Hillcrest Hospital South, hillcrestsouth.com/news/when-it-comes-reading-food-labels-what%E2%80%99s-most-important.

3. How the data will be used to solve the problem¶

We'll use the machine learning method to train and learn the nutritional content of foods that are known as good foods to eat before or after a workout, and we will categorize the foods in a dataset into appropriate groups ('before work-out foods' and 'after work-out foods'). Doing so allows us to get the list of foods that are more suggested to eat before or after the workout.