In [41]:
%matplotlib inline
import pandas as pd
import seaborn as sns
sns.set(style='ticks', context='poster', font_scale=1.5)
In [52]:
data = pd.read_csv('http://web.stanford.edu/class/psych45/demos/Psych45-nback_stats.csv')
# filter RT column so just a number (ms and comma not included)
data.avg_rt = data.avg_rt.str.strip(' ms').str.replace(',', '').astype(float)
task_list = ['2-back', '3-back', '4-back']
In [53]:
data.head()
Out[53]:
In [59]:
data.groupby(['task']).count().when
Out[59]:
In [63]:
data.groupby(['task']).mean().reset_index()
Out[63]:
In [54]:
g = sns.factorplot(x='task', y='percent_correct',
x_order=task_list,
data=data,
palette='Set1', ci=68,
aspect=1.5)
g.set_ylabels('% correct')
sns.despine(trim=True)
In [56]:
g = sns.factorplot(x='task', y='avg_rt',
x_order=task_list,
data=data,
palette='Set1', ci=68,
aspect=1.5)
g.set_ylabels('avg RT')
sns.despine(trim=True)
In [ ]: