title: python Help with calculating the average and std on excel files
body: <p>im trying to calculate the average and std for x, y, and z column for about 50 excel files that i saved in a folder. each excel files has x values in the first column, y in the second, and z in the third column. im using this script, but it kept giving me error. All the files are saved as ".xls". please help and if you guys know any other way i can do this that would be very helpful. Here is the Script and the error:</p>
  
  <pre><code>    import xlrd
      import numpy
      import os
  
      path = "E:\\hello\\Patient"
      dirList=os.listdir(path)
      f = open('E:\\hello\\try.xls', 'w')
      f.write('Patient_ID, Xavg, xstd, yavg, ystd, zavg, ystd')
      f.write("\n")
  
      ##print dirList
      ##i = 0
      Col_values=[]
      for file in dirList:
          fullpath = os.path.join(path,file)
      ##    print fullpath
          if os.path.isfile(fullpath) == 1:
              wb = xlrd.open_workbook(fullpath)
              sh = wb.sheet_by_index(0)
              f.write(str(file))
              f.write(", ")
              for i in range(0,3):
                  for j in range(sh.nrows):
                      Col_values.append(sh.cell(j,i).value)
                  a = numpy.average(Col_values)
                  b = numpy.std(Col_values)
                  f.write(str(a))
                  f.write(", ")
                  f.write(str(b))
                  f.write(", ")
              f.write("\n")
  
      f.close()
  </code></pre>