title: ZeroDivisionError: float division by zero in a code for Surface plot
body: <p>I have got this code to generate a surface plot. But it gives a zero division error. I am not able to figure out what is wrong. Thank you. </p>
  
  <pre><code>import pylab, csv
  import numpy
  from mayavi.mlab import *
  
  def getData(fileName):
      try:
          data = csv.reader(open(fileName,'rb'))
      except:
          print 'File not found'
      else:
          data = [[float(row[0]), float(row[1]),float(row[2])] for row in data]
          x = [row[0] for row in data]
          y = [row[1] for row in data]
          z = [row[2] for row in data]
      return (x, y, z)
  
  def plotData(fileName):
      xVals, yVals, zVals = getData(fileName)
      xVals = pylab.array(xVals)   
      yVals = pylab.array(yVals)
      zVals = (pylab.array(zVals)*10**3)
      x, y = numpy.mgrid[-0.5:0.5:0.001, -0.5:0.5:0.001]  
      s = surf(x, y, zVals)
      return s
  
  plotData('data')   
  </code></pre>