Open In App

Calculate Bodyfat Percentage with skinfold measurements using Python

Fitness is Important for everyone. Children and adults of all ages need regular physical activity. Physical activity promotes good health, and you can be always active at any age. Let write python scripts to help them to calculate their bodyfat percentage. Bodyfat Percentage can be calculated with skinfold measurements (Calipers). Caliper is a device in which you can measure skin folds of triceps, biceps, suprailiac, thigh, and puts those measurements into a formula.

We are going to use the fitness-tools module to calculate body fat percentage. Before starting we need to install the fitness-tools module:



Installation

This module does not come built int with Python. To install this type the below command in the terminal.

pip install fitness-tools

Method 1: 



Consider a 25-year-old female whose skinfold measurements in millimeters are:

triceps = 5
biceps = 7
thigh = 8
suprailiac = 12

Approach:

Below is the implementation:




from fitness_tools.composition.bodyfat import DurninWomersley
 
 
data = DurninWomersley(25, 'female', (5, 7, 8, 12))
data.body_density()

 Output: 

1.0519807465544626

Get the body fat 




# pass the body density value to a
# bodyfat equation inherited from
# GenericCalculator
data.siri(data.body_density())

 
Output: 

20.5

Note: According to the Durnin Womersley equation, our hypothetical female’s body fat is 20.5%.

Method 2: We can use JacksonPollock4Site class to get direct data from the given measurement. 




from fitness_tools.composition.bodyfat import JacksonPollock4Site
 
 
data = JacksonPollock4Site(20, 'male', (7, 8, 6, 7))
 
# Calculates bodyfat directly
data.body_fat()

Output: 

5.2

Note: According to the JacksonPollock4Site equation, the hypothetical male has a body fat percent of 5.2%.

 


Article Tags :