<jupyter_start><jupyter_text>![Brazil Flag](http://www.brazil.org.za/brazil-images/brazil-flag.png)  **<NAME>**   **<NAME>**   **An Analysis of the Brazilian Economy between 2000 and 2012**   Final Project In Partial Fulfillment of the Course Requirements    [**Data Bootcamp**](http://nyu.data-bootcamp.com/)   Stern School of Business, NYU Spring 2017   **May 12, 2017**    The Brazilian EconomyIn this project we examine in detail different complexities of Brazil’s growth between the years 2000-2012. During this period, Brazil set an example for many of the major emerging economies in Latin America, Africa, and Asia. From the years 2000-2012, Brazil was one of the fastest growing major economies in the world. It is the 8th largest economy in the world, with its GDP totalling 2.2 trillion dollars and GDP per Capita being at 10,308 dollars. While designing this project, we were interested to find out more about the main drivers of the Brazilian economy. Specifically, we aim to look at specific trends and indicators that directly affect economic growth, especially in fast-growing countries such as Brazil. Certain trends include household consumption and its effects on the GDP, bilateral aid and investment flows and its effects on the GDP per capita growth. We also aim to view the effects of economic growth on climate change and public health by observing the carbon emissions percentage changes and specific indicators like the mortality rate.We will be looking at generally accepted economic concepts and trends, making some hypotheses, and comparing our hypotheses to the Brazil data we have. Did Brazil follow these trends on its path to economic growth?  Methodology - Data AcquisitionAll the data we are using in this project was acquired from the World Bank and can be accessed and downloaded from the [website](www.WorldBank.org). By going on the website and searching for “World data report” we were given access to information that has to be submitted by the respective countries on the site. By clicking “[Brazil](http://databank.worldbank.org/data/reports.aspx?source=2&country=BRA),” we’re shown the information of several economic indicators and their respective data over a time period of 2000-2012 that we downloaded as an excel file. We picked more than 20 metrics to include in our data, such as: * Population* GDP (current US Dollars)* Household final consumption expenditure, etc. (% of GDP)* General government final consumption expenditure (current US Dollars)* Life expectancy at birth, total (years) For all of our analysis and data we will be looking at the 2000-2012 time period and have filtered the spreadsheets accordingly to reflect this information.<jupyter_code># Inportant Packages
import pandas as pd
import matplotlib.pyplot as plt
import sys
import datetime as dt
print('Python version is:', sys.version)
print('Pandas version:', pd.__version__)
print('Date:', dt.date.today())<jupyter_output>Python version is: 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul  5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)]
Pandas version: 0.18.1
Date: 2017-05-11<jupyter_text>Reading in and Cleaning up the DataWe downloaded our [data](http://databank.worldbank.org/data/AjaxDownload/FileDownloadHandler.ashx?filename=67fd49af-3b41-4515-b248-87b045e61886.zip&filetype=CSV&language=en&displayfile=Data_Extract_From_World_Development_Indicators.zip) in xlxs, retained and renamed the important columns, and deleted rows without enough data. We alse transposed the table to make it easier to plot diagrams.<jupyter_code>path = 'C:\\Users\\emeka_000\\Desktop\\Bootcamp_Emeka.xlsx'
odata = pd.read_excel(path, 
                    usecols = ['Series Name','2000 [YR2000]', '2001 [YR2001]', '2002 [YR2002]',
                               '2003 [YR2003]', '2004 [YR2004]', '2005 [YR2005]', '2006 [YR2006]',
                               '2007 [YR2007]', '2008 [YR2008]', '2009 [YR2009]', '2010 [YR2010]',
                               '2011 [YR2011]', '2012 [YR2012]']
                    ) #retained only the necessary columns 

odata.columns = ['Metric', '2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008',
               '2009', '2010', '2011', '2012'] #easier column names

odata = odata.drop([20, 21, 22, 23, 24]) ##delete NaN values

odata = odata.transpose() #transpose to make diagram easier


odata #data with metrics description for the chart below
data = pd.read_excel(path, 
                    usecols = ['2000 [YR2000]', '2001 [YR2001]', '2002 [YR2002]',
                               '2003 [YR2003]', '2004 [YR2004]', '2005 [YR2005]', '2006 [YR2006]',
                               '2007 [YR2007]', '2008 [YR2008]', '2009 [YR2009]', '2010 [YR2010]',
                               '2011 [YR2011]', '2012 [YR2012]']
                    ) #same data but modified for pandas edits 

data.columns = ['2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008',
               '2009', '2010', '2011', '2012'] #all columns are now string

data = data.transpose() #data used for the rest of the project<jupyter_output><empty_output><jupyter_text>GDP Growth and GDP Growth Rate in Brazil To demonstrate Brazil's strong economic growht between 2000 and 2012, here are a few charts illustrating Brazil's GDP growth. Gross domestic product (GDP) is the monetary value of all the finished goods and services produced within a country's borders in a specific time period. Though GDP is usually calculated on an annual basis, it can be calculated on a quarterly basis as well. GDP includes all private and public consumption, government outlays, investments and exports minus imports that occur within a defined territory. Put simply, GDP is a broad measurement of a nation’s overall economic activity.GDP per Capita is a measure of the total output of a country that takes gross domestic product (GDP) and divides it by the number of people in the country. Read more on [Investopedia](http://www.investopedia.com/terms/g/gdp.aspixzz4gjgzo4Ri)<jupyter_code>data[4].plot(kind = 'line',  #line plot
             title = 'Brazil Yearly GDP (2000-2012) (current US$)',   #title
             fontsize=15,
             color='Green', 
             linewidth=4, #width of plot line
             figsize=(20,5),).title.set_size(20) #set figure size and title size

plt.xlabel("Year").set_size(15) 
plt.ylabel("GDP (current US$) * 1e12").set_size(15) #set x and y axis, with their sizes

data[6].plot(kind = 'line',
             title = 'Brazil Yearly GDP Per Capita (2000-2012) (current US$)', 
             fontsize=15, 
             color='blue', 
             linewidth=4, 
             figsize=(20,5)).title.set_size(20)

plt.xlabel("Year").set_size(15)
plt.ylabel("GDP per capita (current US$)").set_size(15)
data[5].plot(kind = 'line', 
             title = 'Brazil Yearly GDP Growth (2000-2012) (%)',  
             fontsize=15, 
             color='red', 
             linewidth=4, 
             figsize=(20,5)).title.set_size(20)

plt.xlabel("Year").set_size(15)
plt.ylabel("GDP Growth (%)").set_size(15)<jupyter_output><empty_output><jupyter_text>GDP Growth vs. GDP Growth RateWhile Brazil's GDP was growing quite consistently over the 12 years, its GDP growth-rate was not steady with negative growth during the 2008 financial crisis.   Hypothesis: Household Consumption vs. Foreign AidOur hypothesis is that household consumption is a bigger driver of the Brazilian economy than foreign aid. With their rising incomes, Brazilians are expected to be empowered with larger disposable incomes to spend on goods and services. Foreign aid, on the other hand, might not filter down to the masses for spending.<jupyter_code>fig, ax1 = plt.subplots(figsize = (20,5))

y1 = data[8]
y2 = data[4]

ax2 = ax1.twinx()

ax1.plot(y1, 'green') #household consumption
ax2.plot(y2, 'blue') #GDP growth

plt.title("Household Consumption (% of GDP) vs. GDP").set_size(20)<jupyter_output><empty_output><jupyter_text>Actual: Household ConsumptionGDP comprises of household consumption, net investments, government spending and net exports;increases or decreases in any of these areas would affect the overall GDP respectively. The data shows that despite household consumption decreasing as a % of GDP, the GDP was growing. We found this a little strange and difficult to understand. One explanation for this phenomenon could be that as emerging market economies continue to expand, there is an increased shift towards investments and government spending. The blue line represents GDP growth and the green line represents Household Consumption.<jupyter_code>fig, ax1 = plt.subplots(figsize = (20, 5))

y1 = data[11]
y2 = data[4]

ax2 = ax1.twinx()

ax1.plot(y1, 'red') #Net official development assistance 
ax2.plot(y2, 'blue') #GDP growth

plt.title("Foreign Aid vs. GDP").set_size(20)<jupyter_output><empty_output><jupyter_text>Actual: Foreign AidRegarding foreign aid, it should be the case that with decreases in aid there will be reduced economic growth because many developing countries do rely on that as a crucial resource. The data shows a positive corellation for Brazil. While household spending was not a major driver of the Brazil's GDP growth, foreign aid played a big role. We will now explore how foreign direct investment and government spending can affect economic growth.  The blue line represents GDP growth and the red line represents Foreign Aid.   Hypothesis: Foreign Direct Investment vs. Government SpendingFor emerging market economies, the general trend is that Governments contribute a significant proportion to the GDP. Given that Brazil experienced growth between the years 2000-2012, it is expected that a consequence was increased foreign direct investment. Naturally, we’d like to compare the increases in Government Spending versus this foreign direct investment and see who generally contributed more to the GDP growth of the country. Our hypothesis is that the increased foreign direct investment was a bigger contributor to the GDP growth than government spending. With increased globalisation, we expect many multinationals and investors started business operations in Brazil due to its large, fast-growing market.<jupyter_code>fig, ax1 = plt.subplots(figsize = (20, 5))

y1 = data[2]
y2 = data[4]

ax2 = ax1.twinx()

ax1.plot(y1, 'yellow') #household consumption
ax2.plot(y2, 'blue') #GDP growth

plt.title("Foreign Direct Investment (Inflows) (% of GDP) vs. GDP").set_size(20)<jupyter_output><empty_output><jupyter_text>Actual: Foreign Direct InvestmentContrary to popular belief and economic concepts, increased foreign direct investment did not act as a major contributor to the GDP growth Brazil experienced. There is no clear general trend or correlation between FDI and GDP growth.<jupyter_code>fig, ax1 = plt.subplots(figsize = (20, 5))

y1 = data[14]
y2 = data[4]

ax2 = ax1.twinx()

ax1.plot(y1, 'purple') #household consumption
ax2.plot(y2, 'blue') #GDP growth

plt.title("Government Spending vs. GDP").set_size(20)<jupyter_output><empty_output><jupyter_text>Actual: Government SpendingIt is clear that government spending is positively corellated with the total GDP growth Brazil experienced. We believe that this was the major driver for Brazil's growth.  Hypothesis: Population Growth and GDP per capitaBrazil’s population growth continued to increase during this time period of 2000-2012. As mentioned earlier, Brazil’s GDP growth was also growing during the same time period. Given that GDP per capita is a nice economic indicator to highlight standard of living in a country, we wanted to see if the increasing population was negating the effects of increased economic growth.Our hypothesis is that even though population was growing, the GDP per capita over the years generally increased at a higher rate and, all things equal, we are assured increased living standards in Brazil. This finding would prove to us that the GDP was growing at a faster rate than the population.<jupyter_code>data.plot.scatter(x = 5, y = 0,
                  title = 'Population Growth vs. GDP Growth',
                  figsize=(20,5)).title.set_size(20)

plt.xlabel("GDP Growth Rate").set_size(15)
plt.ylabel("Population Growth Rate").set_size(15)<jupyter_output><empty_output><jupyter_text>Actual: Population Growth There is no correlation between the population growth rate and the overall GDP growth rate. The general GDP rate already accounts for population increases and decreases.<jupyter_code>data.plot.scatter(x = 6, y = 0,
                  title = 'Population Growth vs. GDP per Capita',
                  figsize=(20,5)).title.set_size(20)

plt.xlabel("GDP per Capita").set_size(15)
plt.ylabel("Population Growth Rate").set_size(15)<jupyter_output><empty_output><jupyter_text>Population Growth The population growth rate has a negative correlation with GDP per capita. Our explanation is that, as economies advance, the birth rate is expected to decrease. This generally causes population growth rate to fall and GDP per Capita to rise.   Hypothesis: Renewable Energy Expenditures and C02 EmissionsWhat one would expect is that as a country’s economy grows, its investments in renewable energy methods would increase as well. Such actions should lead to a decrease in CO2 emissions as cleaner energy processes are being applied. Our hypothesis disagrees with this.We believe that despite there being significant increases in renewable energy expenditures due to increased incomes and a larger, more diversified economy, there will still be more than proportionate increases in C02 emissions. By testing this hypothesis we will begin to understand certain explanations as to why this may be true or false.<jupyter_code>data[15].plot(kind = 'bar', 
            title = 'Renewable energy consumption (% of total) (2000-2012)', 
             fontsize=15,
             color='green', 
             linewidth=4, 
             figsize=(20,5)).title.set_size(20)
data[12].plot(kind = 'bar', 
            title = 'CO2 emissions from liquid fuel consumption (2000-2012)', 
             fontsize=15,
             color='red', 
             linewidth=4, 
             figsize=(20,5)).title.set_size(20)
data[13].plot(kind = 'bar', 
            title = 'CO2 emissions from gaseous fuel consumption  (2000-2012)', 
             fontsize=15, 
             color='blue', 
             linewidth=4, 
             figsize=(20,5)).title.set_size(20)<jupyter_output><empty_output><jupyter_text>Actual: Renewable Energy Consumption vs. CO2 EmmissionsAs countries continue to grow their economies, it is expected that people’s incomes will continue to rise. Increased disposable incomes should cause better energy consumption methods but as our hypothesis states, C02 emissions still continue to rise. This could be due to the increase in population as more people are using carbon goods and products.  Hypothesis: Health Expenditures and Life ExpectancyThere should be a positive correlation between health expenditures and life expenditures. Naturally, the more a country is spending on healthcare, the higher the life expectancy ought to be. Our hypothesis agrees with this positive statement and we’d like to test it. If it turns out that health expenditure increases positively affects life expectancy, then we can attribute the increase to an improved economy that allows for more health expenditures from individuals, organisations and institutions.<jupyter_code>data.plot.scatter(x = 7, y = 19, #scatter plot
                  title = 'Health Expenditures vs. Life Expectancy',
                  figsize=(20,5)).title.set_size(20)

plt.xlabel("Health Expenditures").set_size(15)
plt.ylabel("Life Expectancy").set_size(15)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08110856852275616, 'fraction_numerical': 0.04519450800915332, 'mean_word_length': 4.116422764227642, 'pattern_counts': {'":': 0, '<': 46, '<?xml version=': 0, '>': 46, 'https://': 0, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '9118', 'license': 'MIT', 'n_tokens_mistral': 4843, 'n_tokens_neox': 4056, 'n_words': 1879, 'path': 'UG_S17/Mba-Kalu_Onwughalu-Brazil.ipynb', 'repo_name': 'NYUDataBootcamp/Projects', 'size': '15756'}