Don't wanna be here? Send us removal request.
Text
Coursera. Week4. GDP per capita and Co2 emissions.
I started this course, because I wanted to learned how to manage and visualize data. Along the way, because I live in Poland, I wanted to examine the relation between GDP per capita and CO2 emissions, because countries like Poland and other developing economies are attacked by the representatives of the richest economies in the world for polluting (i.e. with CO2) atmosphere on Earth.
As you shall see, the 10% of the richest countries in the world, basically the G20, are the biggest pollutants. And that is not an opinion, it is a fact!;)
I. CO2 emission
The basic numeric description of the CO2 emissions data is as follows:
Count 200 countries
Mean 5033261621.6 tons Std 25738118429.8 tons Min 32000.0 tons 25% 34846166.6 tons 50% 185901833.3 tons 75% 1846084166.6 tons Max 334220872333.3 tons
Additionally, I obtained the median value for CO2 emissions: 185901833.3333335 tons).
As you can see the standard the deviation is very high.
2. GDP per capita
When it comes to GDP er capita the standard bar graph tells us much more:
The basic description GDP per capita data: Count 190 countries Mean 8740.966076 Std 14262.809083 Min 103.775857 25% 748.245151 50% 2553.496056 75% 9379.891165 Max 105147.437697
Additionally, I obtained the median of GDP per capita: 2553.49 US $.
3. The Association Between GDP per capita and C02 Emissions
I visualized the association between GDP per capita and C02 Emissions. Firstly, I used a simple scatterplot, but its informative value was low. Than, I divided the countries into 10 subgroups, each consisting of 19 countries.
The 19 richest countries in the world, by far the most, pollute the environment.
Below you can see a program:
import pandas as pd import numpy import seaborn import matplotlib.pyplot as plt
data = pd.read_csv("gapminder.csv", low_memory=False)
#Set PANDAS to show all columns in DataFrame pd.set_option('display.max_columns', None) #Set PANDAS to show all rows in DataFrame pd.set_option('display.max_rows', None)
# bug fix for display formats to avoid run time errors pd.set_option('display.float_format', lambda x:'%f'%x)
data["incomeperperson"] = data["incomeperperson"].convert_objects(convert_numeric=True) data["co2emissions"] = data["co2emissions"].convert_objects(convert_numeric=True) data["urbanrate"] = data["urbanrate"].convert_objects(convert_numeric=True)
income1 = data["incomeperperson"].value_counts(sort=False, dropna=False) income2 = data["incomeperperson"].value_counts(sort=False, normalize=True)
co2 = data["co2emissions"].value_counts(sort=False, dropna=False) co22 = data["co2emissions"].value_counts(sort=False, normalize=True)
urban1 = data["urbanrate"].value_counts(sort=False, dropna=False) urban2 = data["urbanrate"].value_counts(sort=False, normalize=True)
#SKOPIOWANE print ('GDP per capita') descGDP = data["incomeperperson"].describe() print (descGDP)
print ('CO2 Emissions') descCO2 = data["co2emissions"].describe() print (descCO2)
seaborn.distplot(data["incomeperperson"].dropna(), kde=False); plt.xlabel('GDP per Capita') plt.title('2010 Gross Domestic Product per capita in constant 2000 US$')
seaborn.distplot(data["co2emissions"].dropna(), kde=False); plt.xlabel("CO2 Emissions") plt.title("Cumulative CO2 emission in metric tons since 1751")
print ('median CO2') median1 = data['co2emissions'].median() print (median1)
print ('median GDP') median2 = data['incomeperperson'].median() print (median2)
print ('mode CO2') mode1 = data['incomeperperson'].mode() print (mode1)
print ('mode CO2') mode2 = data['co2emissions'].mode() print (mode2)
scat1 = seaborn.regplot(x="incomeperperson", y="co2emissions", fit_reg=False, data=data) plt.xlabel('GDP per capita') plt.ylabel('CO2 Emissions') plt.title('Scatterplot for the Association Between GDP per capita and Co2 Emissions')
# 10th split (use qcut function & ask for 10groups - gives you quartile split) print('Income per person - 4 categories - quartiles') data['INCGR']=pd.qcut(data.incomeperperson, 10, labels=["10","20%","30%","40%", "50%", "60%", "70%", "80%", "90%", "100%"]) INCGR = data['incomeperperson'].value_counts(sort=False, dropna=True) print(INCGR)
# bivariate bar graph C->Q seaborn.factorplot(x='INCGR', y='co2emissions', data=data, kind="bar", ci=None) plt.xlabel('GDP per capita from the poorest to the richest countries') plt.ylabel('Co2 Emissions')
0 notes
Text
Coursera. Week3 Assignment
Hello Classmates,
I am presenting you the code of my program, three tables with numeric values and frequency distributions. The variables in question are as follows: GDP per capita, Co2 emission and urban rate.
The data in Gapminder.csv isn’t really structured so it is really pointless to present frequency distributions. Therefore, firstly I divided each variable in 4 groups and then I provided frequency distribution.
I coded out the missing data in case of each variable.
And I think my work is done.


0 notes
Text
Gapminder - income per person; co2emissions and urbanrate
Hello classmates,
Spoiler alert: I work on dataset which is not really best suited for examining frequency distributions. Although I think that not the final result is important in the case of this week assignment, but a process that stands behind it.
Therefore, I have wrote program that present three columns: income per person, co2emissions and urban rate.
When it comes to numeric values in case of each country the case is clear. Each table shows for every country a specific number. When it comes to examining frequency distributions the only value which shows up is 0.004695. It is pretty simple, there are 213 countries in the world and every vaule in case of urbanrate, co2emission, income per person appears only once. Therefore 213/100 = 0,4695%.
It is not impressive, but I think I managed to do something here.
The code:
import pandas import numpy
data = pandas.read_csv("gapminder.csv", low_memory=False)
print(len(data)) print(len(data.columns))
print("incomeperperson GDP per capita") income1 = data["incomeperperson"].value_counts(sort=False) print(income1)
print("incomeperperson GDP per capita procenty") income2 = data["incomeperperson"].value_counts(sort=False, normalize=True) print(income2)
print("co2emission") co2 = data["co2emissions"].value_counts(sort=False) print(co2)
print("co2emissions %") co22 = data["co2emissions"].value_counts(sort=False, normalize=True) print(co22)
print("urbanrate") urban1 = data["urbanrate"].value_counts(sort=False) print(urban1)
print("urbanrate procenty") urban2 = data["urbanrate"].value_counts(sort=False, normalize=True) print(urban2)
Numer of rows: 213 Number of countries: 16
Incomeperperson: specific values
2344.89691619809 1 4180.765820678 1 155.033231230204 1 1232.79413697982 1 1714.94288994653 1 2062.1251523574 1 5330.40161203986 1 5528.36311387522 1 2425.4712932681 1 23 2923.1443547617 1 105147.437696852 1 1959.8444724473 1 6338.49466772177 1 2668.02051890396 1 18982.2692850615 1 16372.4997808892 1 4699.41126207406 1 21943.3398976022 1 722.807558834445 1 456.385711651118 1 668.54794303958 1 6105.28074296134 1 14778.1639288175 1 1036.830724903 1 595.874534521728 1 372.728414000128 1 39309.4788585145 1 495.734246943527 1 10480.8172032185 1 .. 33931.8320786356 1 22878.4665673261 1 5332.23859142075 1 1253.29201505445 1 6238.53750622149 1 2221.18566404139 1 9106.32723421876 1 27110.731590755 1 1324.19490626644 1 1392.41182851517 1 131.79620701044 1 2231.99333515006 1 25575.3526227298 1 24496.0482640925 1 9425.32586978275 1 1383.40186887912 1 468.69604355829 1 4495.04626152988 1 5348.59719186494 1 1194.71143337515 1 115.305995904875 1 1525.78011590162 1 1295.74268608629 1 1200.65207493742 1 2222.33505218301 1 354.599726291282 1 5011.21945633632 1 5184.70932756049 1 2737.67037938365 1 336.368749481516 1
Name: incomeperperson, Length: 191, dtype: int64
Incomeperperson: frequency distribution
2344.89691619809 0.004695 4180.765820678 0.004695 155.033231230204 0.004695 1232.79413697982 0.004695 1714.94288994653 0.004695 2062.1251523574 0.004695 5330.40161203986 0.004695 5528.36311387522 0.004695 2425.4712932681 0.004695 0.107981 2923.1443547617 0.004695 105147.437696852 0.004695 1959.8444724473 0.004695 6338.49466772177 0.004695 2668.02051890396 0.004695 18982.2692850615 0.004695 16372.4997808892 0.004695 4699.41126207406 0.004695 21943.3398976022 0.004695 722.807558834445 0.004695 456.385711651118 0.004695 668.54794303958 0.004695 6105.28074296134 0.004695 14778.1639288175 0.004695 1036.830724903 0.004695 595.874534521728 0.004695 372.728414000128 0.004695 39309.4788585145 0.004695 495.734246943527 0.004695 10480.8172032185 0.004695
33931.8320786356 0.004695 22878.4665673261 0.004695 5332.23859142075 0.004695 1253.29201505445 0.004695 6238.53750622149 0.004695 2221.18566404139 0.004695 9106.32723421876 0.004695 27110.731590755 0.004695 1324.19490626644 0.004695 1392.41182851517 0.004695 131.79620701044 0.004695 2231.99333515006 0.004695 25575.3526227298 0.004695 24496.0482640925 0.004695 9425.32586978275 0.004695 1383.40186887912 0.004695 468.69604355829 0.004695 4495.04626152988 0.004695 5348.59719186494 0.004695 1194.71143337515 0.004695 115.305995904875 0.004695 1525.78011590162 0.004695 1295.74268608629 0.004695 1200.65207493742 0.004695 2222.33505218301 0.004695 354.599726291282 0.004695 5011.21945633632 0.004695 5184.70932756049 0.004695 2737.67037938365 0.004695 336.368749481516 0.004695
Name: incomeperperson, Length: 191, dtype: float64
Co2emission: specific values
23635333.3333333 1 86317000 1 4814333.33333333 1 254206333.333333 1 2420300666.66667 1 104170000 1 1425435000 1 2907666.66666667 1 8968666.66666667 1 5214000 1 132000 1 1111000 1 277170666.666667 1 23404568000 1 9580226333.33333 1 169180000 1 1962704333.33333 1 254939666.666667 1 598774000 1 102538333.333333 1 3157700333.33333 1 137555000 1 88337333.3333333 1 2329308666.66667 1 236419333.333333 1 20331666.6666667 1 4244009000 1 20628666.6666667 1 21351000 1 7601000 1 .. 40857666.6666667 1 119958666.666667 1 7388333.33333334 1 283583666.666667 1 1718339333.33333 1 5584766000 1 125172666.666667 1 2421917666.66667 1 1865922666.66667 1 334220872333.333 1 170404666.666667 1 4774000 1 10897025333.3333 1 1321661000 1 275744333.333333 1 223747333.333333 1 100782000 1 322960000 1 2335666.66666667 1 92770333.3333334 1 33341634333.3333 1 850666.666666667 1 87970666.6666667 1 81191000 1 107096000 1 4286590000 1 428006333.333333 1 811965000 1 692039333.333333 1 503994333.333333 1 Name: co2emissions, Length: 201, dtype: int64
Co2emissions: frequency distribution
23635333.3333333 0.004695 86317000 0.004695 4814333.33333333 0.004695 254206333.333333 0.004695 2420300666.66667 0.004695 104170000 0.004695 1425435000 0.004695 2907666.66666667 0.004695 8968666.66666667 0.004695 5214000 0.004695 132000 0.004695 1111000 0.004695 277170666.666667 0.004695 23404568000 0.004695 9580226333.33333 0.004695 169180000 0.004695 1962704333.33333 0.004695 254939666.666667 0.004695 598774000 0.004695 102538333.333333 0.004695 3157700333.33333 0.004695 137555000 0.004695 88337333.3333333 0.004695 2329308666.66667 0.004695 236419333.333333 0.004695 20331666.6666667 0.004695 4244009000 0.004695 20628666.6666667 0.004695 21351000 0.004695 7601000 0.004695
40857666.6666667 0.004695 119958666.666667 0.004695 7388333.33333334 0.004695 283583666.666667 0.004695 1718339333.33333 0.004695 5584766000 0.004695 125172666.666667 0.004695 2421917666.66667 0.004695 1865922666.66667 0.004695 334220872333.333 0.004695 170404666.666667 0.004695 4774000 0.004695 10897025333.3333 0.004695 1321661000 0.004695 275744333.333333 0.004695 223747333.333333 0.004695 100782000 0.004695 322960000 0.004695 2335666.66666667 0.004695 92770333.3333334 0.004695 33341634333.3333 0.004695 850666.666666667 0.004695 87970666.6666667 0.004695 81191000 0.004695 107096000 0.004695 4286590000 0.004695 428006333.333333 0.004695 811965000 0.004695 692039333.333333 0.004695 503994333.333333 0.004695 Name: co2emissions, Length: 201, dtype: float64
Urbanrate: specific values
19.56 1 77.54 1 73.46 1 20.72 1 86.56 1 30.46 1 69.02 1 25.52 1 10 59.62 1 60.3 1 21.6 1 10.4 1 69.46 1 47.04 1 56.7 1 46.72 1 75.66 1 41 1 68.12 1 57.28 1 92.26 1 77.2 1 85.04 1 84.54 1 63.3 1 100 6 67.5 1 77.48 1 74.92 1 .. 16.54 1 50.02 1 88.44 1 56.42 1 77.12 1 68.08 1 32.18 1 17.96 1 39.84 1 38.58 1 98.32 1 51.46 1 82.42 1 73.48 1 36.16 1 56.76 1 73.2 1 56.02 1 86.96 1 42.48 1 12.54 1 64.78 1 30.64 1 86.68 1 57.18 1 34.48 1 81.7 1 13.22 1 37.86 1 77.88 1 Name: urbanrate, Length: 195, dtype: int64
Urbanrate: frequency distribution
19.56 0.004695 77.54 0.004695 73.46 0.004695 20.72 0.004695 86.56 0.004695 30.46 0.004695 69.02 0.004695 25.52 0.004695 0.046948 59.62 0.004695 60.3 0.004695 21.6 0.004695 10.4 0.004695 69.46 0.004695 47.04 0.004695 56.7 0.004695 46.72 0.004695 75.66 0.004695 41 0.004695 68.12 0.004695 57.28 0.004695 92.26 0.004695 77.2 0.004695 85.04 0.004695 84.54 0.004695 63.3 0.004695 100 0.028169 67.5 0.004695 77.48 0.004695 74.92 0.004695
16.54 0.004695 50.02 0.004695 88.44 0.004695 56.42 0.004695 77.12 0.004695 68.08 0.004695 32.18 0.004695 17.96 0.004695 39.84 0.004695 38.58 0.004695 98.32 0.004695 51.46 0.004695 82.42 0.004695 73.48 0.004695 36.16 0.004695 56.76 0.004695 73.2 0.004695 56.02 0.004695 86.96 0.004695 42.48 0.004695 12.54 0.004695 64.78 0.004695 30.64 0.004695 86.68 0.004695 57.18 0.004695 34.48 0.004695 81.7 0.004695 13.22 0.004695 37.86 0.004695 77.88 0.004695 Name: urbanrate, Length: 195, dtype: float64
0 notes
Text
The Codebook
I have chosen Gapminder Codebook as a point of departure for my further investigations.
The subject of the study
We are facing the worst climate crisis due to climate warming in the history of the planet. Therefore I plan to analyze the levels of co2emissions thanks to the availability of data provided by CDIAC (Carbon Dioxide Information Analysis Center).
The variable
There is ongoing debate between countries classified as developed economies and countries identified as emerging economies. The emerging economies countries assert that reducing co2emissions is costly to their societies and therefore they should be subsized by much richer countries, if they have to reorganized their economies which are traditionally based on coal as a main source of energy.
Although there are, as one may expect, many variables which can contribute to high level co2emissions I would like to focus on the relation between wealth of the nation measured by 2010 Gross Domestic Product per capita (incomeperperson) and co2emissions.
Research Question:
Is the level of CO2 emission in a given country associated with its GDP per capita?
Hypothesis:
The higher the GDP per capita, the lower the CO2 emission.
Literature review
According to the literature the richer countries in terms of Total GDP the higher total emission of CO2. However, countries with the highest GDP per capita are not the biggest producers of CO2. Moreover, if GDP per capita rises, the CO2 emissions decrease. On the other side, countries that achieved the highest development in the late three decades, have increased the CO2 emission. The results showed that GDP there is a relation between GDP per capita and the CO2 emissions.
Bibliography:
M. R. Raupach, G. Marland, P. Ciais, C Le Quéré, J G. Canadell, G. Klepper, C. B. Field, Global and regional drivers of accelerating CO2 emissions, “PNAS” 2007, vol 104 (24), p. 10288-10293.
D. Holtz-Eakin,T. M.Seldenab, Stoking the fires? CO2 emissions and economic growth, “Journal of Public Economics” 1995, vol. 57(1), p. 85-101.
J. Lane, CO2 emissions and GDP, “International Journal of Social Economics” 2011, Vol. 38(11), p.911-918.
U. Al-mulali, C. Normee B. Che Sab, The impact of energy consumption and CO2 emission on the economic growth and financial development in the Sub Saharan African countries, “Energy” 2012, Volume 39, Issue 1, p. 180-186.
U. Al-mulali, C. Normee, B. Che Sab, The impact of energy consumption and CO2 emission on the economic and financial development in 19 selected countries, “Renewable and Sustainable Energy Reviews” 2012, Volume 16, Issue 7, p. 4365-4369.
U. Al-mulali, Factors affecting CO2 emission in the Middle East: A panel data analysis, “Energy” 2019, Vol. 44(1), p. 564-569.
J. Duran, M. Golušin, I.O. Munitlak, L. Jovanović, L. Andrejević, Renewable Energy and Socio-economic Development in the European Union, “Problemy Ekorozwoju” 2013, Vol. 8(1), p. 105-114.
0 notes