from utils import data as data_module
table = data_module.csv_table()
print('Total num of participants:')
len(table)
Total num of participants:
23
for group_name, group in zip(['A', 'B'], data_module.to_groups(table)):
male = len(group[group['sex'] == 1])
female = len(group[group['sex'] == 2])
print('Group {}'.format(group_name))
print('Num of participants: {}'.format(len(group)))
print('Male: {}, Female: {}'.format(male, female))
print('Mean age: {:.2f}'.format(group['age'].mean()))
print('Age std: {:.2f}'.format(group['age'].std()))
print('Mean musical education (years) {:.2f}'.format(group.education_years.mean()))
print('Musical education std (years) {:.2f}'.format(group.education_years.std()))
print()
Group A Num of participants: 11 Male: 6, Female: 5 Mean age: 18.70 Age std: 5.41 Mean musical education (years) 3.08 Musical education std (years) 1.02 Group B Num of participants: 12 Male: 7, Female: 5 Mean age: 17.18 Age std: 0.42 Mean musical education (years) 4.89 Musical education std (years) 3.01
print('Mean musical education (years) {:.2f}'.format(table.education_years.mean()))
print('Musical education std (years) {:.2f}'.format(table.education_years.std()))
Mean musical education (years) 4.17 Musical education std (years) 2.53