title: subtracting square wave from csv values
body: <p>I have a .csv file of time and resistance values with non-periodic pulses I need to remove.</p>
  
  <p>This is what I'm trying but can't make the list elements into floats to do the comparison.</p>
  
  <pre><code>import csv
  
  f=open('sample.csv')
  csv_f=csv.reader(f)
  
  res = []
  
  next(csv_f)
  
  for row in csv_f:
      res.append([float(row[1])])
  
  l = len(res)
  previous = current = None
  
  for i, r in enumerate(res):
      if i &gt; 0:
          current = float(res[i])
          previous = float(res[i-1])
          dif = current-previous
          if dif &gt; 1:
              res[i] = res[i] - dif
  </code></pre>
  
  <p>ideally I'd like to continue to subtract this difference until I detect another edge indicating the end of the pulse</p>
  
  <p>with this code I get this error trying to cast the list element as a float</p>
  
  <p>TypeError: float() argument must be a string or a number </p>
  
  <p>if I remove the cast then it says</p>
  
  <p>TypeError: unsupported operand type(s) for -: 'list' and 'list'</p>