code: def limits(table, field):
      
  
      vals = iter(values(table, field))
      try:
          minv = maxv = next(vals)
      except StopIteration:
          return None, None
      else:
          for v in vals:
              if v < minv:
                  minv = v
              if v > maxv:
                  maxv = v
          return minv, maxv
docs: Find minimum and maximum values under the given field. E.g.::
  
          >>> import petl as etl
          >>> table = [['foo', 'bar'], ['a', 1], ['b', 2], ['b', 3]]
          >>> minv, maxv = etl.limits(table, 'bar')
          >>> minv
          1
          >>> maxv
          3
  
      The `field` argument can be a field name or index (starting from zero).