# -*- coding: utf-8 -*-
"""
Created on Sun Oct 4 20:25:31 2015
@author: Abhishek
"""
import pandas
import numpy
import seaborn
import matplotlib.pyplot as plt
data = pandas.read_csv('gapminder.csv', low_memory=False)
pandas.set_option('display.float_format', lambda x: '%f'%x)
data['femaleemployrate'] = data['femaleemployrate'].convert_objects(convert_numeric=True)
data['incomeperperson'] = data['incomeperperson'].convert_objects(convert_numeric=True)
data['polityscore'] = data['polityscore'].convert_objects(convert_numeric=True)
dataG20Copy = data[(data['country'] == 'Argentina') |
(data['country'] == 'Australia') |
(data['country'] == 'Brazil') |
(data['country'] == 'Canada') |
(data['country'] == 'China') |
(data['country'] == 'France') |
(data['country'] == 'Germany') |
(data['country'] == 'India') |
(data['country'] == 'Indonesia') |
(data['country'] == 'Italy') |
(data['country'] == 'Japan') |
(data['country'] == 'Mexico') |
(data['country'] == 'Russia') |
(data['country'] == 'Saudi Arabia') |
(data['country'] == 'South Africa') |
(data['country'] == 'Korea, Rep.') |
(data['country'] == 'Turkey') |
(data['country'] == 'United Kingdom') |
(data['country'] == 'United States')]
# Not always necessary but can eliminate a setting with copy warning that is displayed
dataG20 = dataG20Copy.copy()
# Female Employment Rate
print('Describe Female Employee Rate of G20 countries')
desc1 = dataG20['femaleemployrate'].describe()
print(desc1)
seaborn.distplot(dataG20['femaleemployrate'].dropna(),kde=False);
plt.xlabel('Female Employment Rate')
plt.title('Female Employment Rate in G20 Countries')
# Income Per Person
print('Describe Female Employee Rate of G20 countries')
desc2 = dataG20['incomeperperson'].describe()
print(desc2)
seaborn.distplot(dataG20['incomeperperson'].dropna(),kde=False);
plt.xlabel('Income Per Person')
plt.title('Income Per Person in G20 Countries')
dataG20['polityscorecat'] = dataG20['polityscore'].astype('category')
seaborn.distplot(dataG20['polityscorecat'].dropna(),kde=False);
plt.xlabel('Polity Score')
plt.title('Polity Score of G20 Countries')
scat1 = seaborn.regplot(x="incomeperperson", y="femaleemployrate", fit_reg=False, data=dataG20)
print(scat1)
The Uni-variate graph result
My research question was if income per person is related to female employment rate. It seems like though income female employment rate has a positive relationship to income per person in G20 countries, the relationship is weak.
Hi, I graded your assignment, I like to make friend with people who likes math and sciences. my blog is http://jizongl.github.io/
ReplyDeleteAnyway, nice work, I like the idea that you do your research only on the G20.