In [1]:
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style="white")
sns.set_context("talk")
In [2]:
df = pd.read_csv('raw/2016-17-ClassCentral-Survey-data-noUserText.csv', decimal=',', encoding = "ISO-8859-1")
In [3]:
reason = df[['Which region of the world are you in?', 'Reasons: Learning skills for current career',
'Reasons: Learning skills for new career', 'Reasons: School credit', 'Reasons: Personal interest',
'Reasons: Access to reference materials']]
reason.head()
Out[3]:
In [4]:
multi_reason = pd.melt(reason, id_vars='Which region of the world are you in?',
var_name='select', value_name='score')
multi_reason.head()
Out[4]:
In [5]:
grouped_reason = multi_reason.groupby(['Which region of the world are you in?', 'select'], as_index=False).sum()
grouped_reason.head()
Out[5]:
In [6]:
sns.factorplot(x='score', y='select', hue='Which region of the world are you in?',
data=grouped_reason, kind='bar', size=8, aspect=1.5)
sns.plt.title('Which of the following are important reasons for you to take MOOCs?')
sns.plt.show()