{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from utils import data as data_module" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# General" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Total num of participants:\n" ] }, { "data": { "text/plain": [ "23" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "table = data_module.csv_table()\n", "print('Total num of participants:')\n", "len(table)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Per group statistics" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Group A\n", "Num of participants: 11\n", "Male: 6, Female: 5\n", "Mean age: 18.70\n", "Age std: 5.41\n", "Mean musical education (years) 3.08\n", "Musical education std (years) 1.02\n", "\n", "Group B\n", "Num of participants: 12\n", "Male: 7, Female: 5\n", "Mean age: 17.18\n", "Age std: 0.42\n", "Mean musical education (years) 4.89\n", "Musical education std (years) 3.01\n", "\n" ] } ], "source": [ "for group_name, group in zip(['A', 'B'], data_module.to_groups(table)):\n", " male = len(group[group['sex'] == 1])\n", " female = len(group[group['sex'] == 2])\n", " print('Group {}'.format(group_name))\n", " print('Num of participants: {}'.format(len(group)))\n", " print('Male: {}, Female: {}'.format(male, female))\n", " print('Mean age: {:.2f}'.format(group['age'].mean()))\n", " print('Age std: {:.2f}'.format(group['age'].std()))\n", " print('Mean musical education (years) {:.2f}'.format(group.education_years.mean()))\n", " print('Musical education std (years) {:.2f}'.format(group.education_years.std())) \n", " print()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Overall Stats" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Mean musical education (years) 4.17\n", "Musical education std (years) 2.53\n" ] } ], "source": [ "print('Mean musical education (years) {:.2f}'.format(table.education_years.mean()))\n", "print('Musical education std (years) {:.2f}'.format(table.education_years.std()))" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.4.3" } }, "nbformat": 4, "nbformat_minor": 0 }