text_html_output_1.png
from subprocess import check_output

from subprocess import check_output

import matplotlib.pyplot as plt

import matplotlib.pyplot as plt

import matplotlib.pyplot as plt

import numpy as np # linear algebra

import numpy as np # linear algebra

import os

import os

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

import seaborn as sns

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import os
from subprocess import check_output

data2015 = pd.read_csv('../input/2015.csv')
data2016 = pd.read_csv('../input/2016.csv')
data2017 = pd.read_csv('../input/2017.csv')

data2015.corr()

f,ax = plt.subplots(figsize=(18, 18))
sns.heatmap(data2015.corr(), annot=True, linewidths=.5, fmt= '.1f',ax=ax)
plt.show()

import matplotlib.pyplot as plt

fig, axes = plt.subplots(nrows=2, ncols=2)

df1.plot(ax=axes[0,0])
df2.plot(ax=axes[0,1])
...

#try to set index to dataframe
fig, axes = plt.subplots(figsize=(10, 10),nrows=2, ncols=2)

data_updated=data2015.rename( index=str ,columns={"Happiness Rank":"Happiness_Rank","Standard Error":"Standard_Error"})
data_2015U=data_updated.rename( index=str ,columns={"Happiness Score":"Happiness_Score"})
data_2015U=data_2015U.rename( index=str,columns={"Economy (GDP per Capita)":"Economy","Dystopia Residual":"Dystopia_Residual","Health (Life Expectancy)":"Health","Trust (Government Corruption)":"Trust"})

plt.legend(loc='upper right') 

data_2015U=data_2015U.set_index('Happiness_Rank')
data_2015U.Happiness_Score.plot(ax=axes[0,0],kind = 'line', color = 'red',title = 'Happiness Score',linewidth=1,grid = True,linestyle = ':')
data_2015U.Family.plot( ax=axes[0,1],kind='line' ,color='green' ,title='Family' ,linewidth=1 , grid=True ,linestyle=':' )
data_2015U.Economy.plot( ax=axes[1,0],kind='line' ,color='yellow', title='Economy',linewidth=1,grid=True ,linestyle=':' )
data_2015U.Health.plot( ax=axes[1,1],kind='line' ,color='blue', title='Health',linewidth=1,grid=True ,linestyle=':' )

    # legend = puts label into plot
              # label = name of label

          # title = title of plot

rng = np.random.RandomState(0)
x = rng.randn(100)
y = rng.randn(100)
colors = rng.rand(100)
sizes = 1000 * rng.rand(50)
plt.colorbar()

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import os
print(os.listdir('../input'))
from subprocess import check_output
print(check_output(['ls', '../input']).decode('utf8'))
data2015 = pd.read_csv('../input/2015.csv')
data_updated = data2015.rename(index=str, columns={'Happiness Rank': 'Happiness_Rank'})
data_2015U = data_updated.rename(index=str, columns={'Happiness Score': 'Happiness_Score'})
data_2015U = data_2015U.rename(index=str, columns={'Economy (GDP per Capita)': 'Economy', 'Health (Life Expectancy)': 'Health', 'Trust (Government Corruption)': 'Trust'})
f, ax = plt.subplots(figsize=(20, 12))
Western_Europe = data_2015U[data_2015U.Region == 'Western Europe']
North_America = data_2015U[data_2015U.Region == 'North America']
Australian_New_Zealand = data_2015U[data_2015U.Region == 'Australia and New Zealand']
Middle_East_and_Northern_Africa = data_2015U[data_2015U.Region == 'Middle East and Northern Africa']
Latin_America_and_Caribbean = data_2015U[data_2015U.Region == 'Latin America and Caribbean']
Southeastern_Asia = data_2015U[data_2015U.Region == 'Southeastern Asia']
Central_and_Eastern_Europe = data_2015U[data_2015U.Region == 'Central and Eastern Europe']
Eastern_Asia = data_2015U[data_2015U.Region == 'Eastern_Asia']
Southern_Asia = data_2015U[data_2015U.Region == 'Southern Asia']
for each in range(0, len(Western_Europe.Country)):
    x = Western_Europe.Happiness_Score[each]
    y = Western_Europe.Freedom[each]
    plt.scatter(Western_Europe.Happiness_Score, Western_Europe.Freedom, color='red', linewidth=1)
    plt.text(x, y, Western_Europe.Country[each], fontsize=12)
for each in range(0, len(North_America.Country)):
    x = North_America.Happiness_Score[each]
    y = North_America.Freedom[each]
    plt.scatter(North_America.Happiness_Score, North_America.Freedom, color='blue', linewidth=1)
    plt.text(x, y, North_America.Country[each], fontsize=12)
for each in range(0, len(Middle_East_and_Northern_Africa.Country)):
    x = Middle_East_and_Northern_Africa.Happiness_Score[each]
    y = Middle_East_and_Northern_Africa.Freedom[each]
    plt.scatter(Middle_East_and_Northern_Africa.Happiness_Score, Middle_East_and_Northern_Africa.Freedom, color='purple', linewidth=1)
    plt.text(x, y, Middle_East_and_Northern_Africa.Country[each], fontsize=12)
plt.title('Happiness Score-Freedom Scatter Plot')
plt.xlabel('Happiness Score')
plt.ylabel('Freedom')