-
Notifications
You must be signed in to change notification settings - Fork 0
/
supply_production_demand_GDP
87 lines (54 loc) · 3.21 KB
/
supply_production_demand_GDP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import pandas as pd
# SUPPLY
# Meat
meat_supply_DF = pd.read_csv('meat-supply-per-person.csv')
meat_supply_DF.drop("Code", axis = 1, inplace = True)
# Egg
egg_supply_DF = pd.read_csv('per-capita-egg-consumption-kilograms-per-year.csv')
egg_supply_DF.drop("Code", axis = 1, inplace = True)
# Merged meat and egg
meat_egg_supply = pd.merge(meat_supply_DF, egg_supply_DF, on = ['Entity', 'Year'], how = 'inner')
# Milk
milk_supply_DF = pd.read_csv('per-capita-milk-consumption.csv')
milk_supply_DF.drop("Code", axis = 1, inplace = True)
# Merged meat and egg and milk
meat_egg_milk_supply = pd.merge(meat_egg_supply, milk_supply_DF, on = ['Entity', 'Year'], how = 'inner')
# Merged meat and egg + Food supply (calories) + Life expectancy: 1961-2017
food_supply_v_life_expectancy_DF = pd.read_csv('food_supply_life_expectancy.csv')
food_supply_v_life_expectancy_DF.drop("Code", axis = 1, inplace = True)
food_supply_v_life_expectancy_DF.drop("Continent", axis = 1, inplace = True)
food_supply_v_life_expectancy_DF.drop("Population (historical estimates)", axis = 1, inplace = True)
food_supply_life = pd.merge(meat_egg_milk_supply, food_supply_v_life_expectancy_DF, on = ['Entity', 'Year'], how = 'inner')
# DEMAND: Hypothetical global meat demand if everyone in the world ate the same quantity as the average citizen of a
# given country
meat_demand_DF = pd.read_csv('hypothetical-global-meat-demand.csv')
meat_demand_DF.drop("Code", axis = 1, inplace = True)
# Merged this dataset with the bigger food supply dataset above. Some dates are filtered
# New year range: 1961-2013
supply_and_demand = pd.merge(food_supply_life, meat_demand_DF, on = ['Entity', 'Year'], how = 'inner')
# PRODUCTION
# Meat
meat_prod_DF = pd.read_csv('global-meat-production-by-livestock-type.csv')
meat_prod_DF.drop("Code", axis = 1, inplace = True)
# Egg
egg_prod_DF = pd.read_csv('egg-production-thousand-tonnes.csv')
egg_prod_DF.drop("Code", axis = 1, inplace = True)
# Merged meat and egg
meat_egg_prod = pd.merge(meat_prod_DF, egg_prod_DF, on = ['Entity', 'Year'], how = 'inner')
# Milk
milk_prod_DF = pd.read_csv('milk-production-tonnes.csv')
milk_prod_DF.drop("Code", axis = 1, inplace = True)
# Merged meat egg milk: 1961-2018 (mostly)
meat_egg_milk_prod = pd.merge(meat_egg_prod, milk_prod_DF, on = ['Entity', 'Year'], how = 'inner')
# Supply, demand, production merge: 1961-2013
supply_demand_production = pd.merge(supply_and_demand, meat_egg_milk_prod, on = ['Entity', 'Year'], how = 'inner')
# supply_demand_production.to_csv('supply_demand_production.csv')
# Meat Consumption vs GDP per capita
meat_consumption_GDP_DF = pd.read_csv('meat-consumption-vs-gdp-per-capita.csv')
meat_consumption_GDP_DF.drop("Code", axis = 1, inplace = True)
meat_consumption_GDP_DF.drop("Population (historical estimates)", axis = 1, inplace = True)
meat_consumption_GDP_DF.drop("Continent", axis = 1, inplace = True)
meat_consumption_GDP_DF.drop("Meat food supply quantity (kg/capita/yr) (FAO, 2020)", axis = 1, inplace = True)
# Supply, demand, production, GDP merge: 1961-2013
supply_demand_production_GDP = pd.merge(supply_demand_production, meat_consumption_GDP_DF, on = ['Entity', 'Year'], how = 'inner')
supply_demand_production_GDP.to_csv('supply_demand_production_GDP.csv')