Skip to content

Instantly share code, notes, and snippets.

@Shogun89
Last active September 12, 2019 01:29
Show Gist options
  • Save Shogun89/ca01e3c4e0b6580b683534ce06b68b32 to your computer and use it in GitHub Desktop.
Save Shogun89/ca01e3c4e0b6580b683534ce06b68b32 to your computer and use it in GitHub Desktop.
Body_Fat
import pandas as pd
current_weight = 212
body_fat_percentage = .3
fat_pounds = current_weight* body_fat_percentage
def get_fat_percent(weight_lost, current_weight, fat_percentage):
new_fat = (current_weight*fat_percentage) - 2/3*weight_lost
fat_percent = new_fat/(current_weight-weight_lost)
return fat_percent
weights = range(5,5*18,5)
fat_percent = [get_fat_percent(weight, current_weight, body_fat_percentage) for weight in weights]
new_weight = list(map(lambda x: current_weight - x, weights))
body_fat = [a*b for a,b in zip(new_weight,fat_percent)]
my_array = [fat_percent, weights, new_weight, body_fat]
dict = {'body_fat': fat_percent, 'weight_lost':weights ,'new_weight': new_weight, 'fat_lbs': body_fat}
df = pd.DataFrame(dict)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment