{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Basic Data analyses" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load in the data" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import numpy as np, sys, scipy.stats, pandas as pd, os, os.path, csv#, PythonAnalyses\n", "\n", "import matplotlib\n", "import matplotlib.pyplot as plt\n", "import pylab as pl\n", "%matplotlib inline\n", "pd.options.display.mpl_style = 'default'\n", "\n", "Start = 0 #if I want to reload data from csvs = 1. If i want to load python pickle == 0\n", "\n", "filename = 'AdditionalSingleton_TargetUncertain_Runs.csv'\n", "csvName = 'AdditionalSingleton_TargetUncertain_Runs'\n", "\n", "if sys.platform == 'linux2': #is this my linux laptop\n", " path = '/home/dan-laptop/Dropbox/TargetUncertainty/Exp3'\n", "elif sys.platform == 'darwin': #is this my mac work comp \n", " path = '/Users/danvatterott/Dropbox Encore/Dropbox/TargetUncertainty/Exp3/'\n", "\n", "os.chdir(path)\n", "\n", "if Start == 1: #load in data from csv\n", " numfiles = len([name for name in os.listdir('.') if os.path.isfile(name) and name.endswith(\".csv\") and name[0].isdigit()])\n", " for partnum in xrange(1,numfiles+1): #this is a loop that goes through all participants\n", " filename = '%s_' % str(partnum) + csvName + '.csv'\n", " if partnum == 1: \n", " df = pd.read_csv(filename)\n", " if partnum > 1: \n", " df = df.append(pd.read_csv(filename))\n", " df.columns = map(str.lstrip, df.columns)\n", " df.to_pickle(csvName+'.pkl') #save this data frame all together\n", "elif Start == 0: #load the data from a previously saved python file. should save time if not adding csv data. \n", " df = pd.read_pickle(csvName+'.pkl')" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", " | TarType | \n", "TarLoc | \n", "TarColorCode | \n", "DistCond | \n", "TarDistDist | \n", "DistLoc | \n", "DistLine | \n", "Resp | \n", "Block | \n", "ConstantTar | \n", "ChangeCounter | \n", "Acc | \n", "RT | \n", "Sub# | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "1 | \n", "3 | \n", "2 | \n", "2 | \n", "1 | \n", "2 | \n", "1 | \n", "2 | \n", "0 | \n", "0 | \n", "1 | \n", "0 | \n", "1039.0328 | \n", "1 | \n", "
1 | \n", "2 | \n", "3 | \n", "1 | \n", "1 | \n", "0 | \n", "0 | \n", "0 | \n", "1 | \n", "0 | \n", "0 | \n", "2 | \n", "0 | \n", "3067.5919 | \n", "1 | \n", "
2 | \n", "2 | \n", "5 | \n", "2 | \n", "2 | \n", "2 | \n", "3 | \n", "2 | \n", "2 | \n", "0 | \n", "0 | \n", "3 | \n", "1 | \n", "1230.1895 | \n", "1 | \n", "