title: How to read CSV in chunks of 3 line & Jump lines in chunks, if condition unsatisfied using PYTHON?
body: <p>I have a big CSV file (~20000 lines) like given below. Each line corresponds to data/Second. So 60 lines indicate data from 60 seconds.</p>
  
  <p>I am looking for a stable set of data between three lines. So if COLUMN H data is not varying by more than 5, for consecutive 3 lines, I can call it stable. (297,319,326 varying more than 5, hence unstable).</p>
  
  <p>If varying more than 5, my code should check for another set of 3 lines AFTER  14 SECONDS(after 14 lines). (362,362,355 not varying more than 5, hence stable &amp; one data snapshot is ready), and this continues till the last line, checking for more data snapshots.</p>
  
  <p>Each stable value is then averaged and printed into .TXT file for analysis.</p>
  
  <p>A,B,C,D,E,F,G,<strong>H</strong>,I,J,K,L<br>
  1) FALSE,470,496,,,0,67,<strong>297</strong>,341,"3,701","61,216",0<br>
  2) FALSE,464,497,,,0,67,<strong>319</strong>,341,"3,701","61,216",0<br>
  3) FALSE,460,498,,,0,67,<strong>326</strong>,348,"4,599","61,216",0<br>
  4) FALSE,459,500,,,0,67,<strong>341</strong>,348,"4,599","61,216",0<br>
  ...<br>
  ...<br>
  11) FALSE,460,502,,,0,67,<strong>375</strong>,348,"4,599","61,216",0<br>
  12) TRUE,461,503,,,0,67,<strong>350</strong>,348,"4,599","61,216",0<br>
  13) TRUE,463,504,,,0,67,<strong>355</strong>,348,"5,479","61,216",0<br>
  14) TRUE,467,505,,,0,67,<strong>362</strong>,348,"5,479","61,216",0<br>
  15) TRUE,470,507,,,0,67,<strong>362</strong>,348,"5,479","61,216",0<br>
  16) TRUE,472,508,,,1,67,<strong>355</strong>,355,"5,479","61,216",0  </p>
  
  <p>My code:(PYTHON 3.5)</p>
  
  <p>`</p>
  
  <pre><code>import csv  
  with open ('ABC.csv','r+') as csvfile:  
    reader=csv.reader(csvfile)  
    ROWCOUNT=0;
    for row in reader:  
      ROWCOUNT=ROWCOUNT+1  
      if row[7] in (max(ROWCOUNT,ROWCOUNT+1,ROWCOUNT+2) -min(ROWCOUNT,ROWCOUNT+1,ROWCOUNT+2) &lt; 10:  
        average=avg(ROWCOUNT,ROWCOUNT+1,ROWCOUNT+2)  
      else:  
        ..  
        ... 
  </code></pre>
  
  <p>`  </p>
  
  <p>My code didn't work at all, so as the logic.</p>
  
  <p>SOMEONE PLEASE SUGGEST HOW TO CODE THIS USING PYTHON.</p>