title: Improve CSV file write speed
body: <p>The code below works just fine. I'm wondering is there any way to improve the write speed of it. As it would currently take from 12 to 20 seconds to write the .csv file. </p>
  
  <pre><code>import csv
  import os
  
  data = [...1000 item list, where each item is a dictionary with 8 values...]
  
  for candle in data:
          if os.path.isfile('data'+os.sep+i+os.sep+coin_symbol+'.csv'):
              H = []
              H.append(candle['timestamp'])
              H.append(candle['open'])
              H.append(candle['close'])
              H.append(candle['min'])
              H.append(candle['max'])
              H.append(candle['volume'])
              H.append(candle['volumeQuote'])
  
              with open('data'+os.sep+i+os.sep+coin_symbol+'.csv', 'a', newline="") as csvfile:
                  csvwriter = csv.writer(csvfile, delimiter=',')
                  csvwriter.writerow(H)
          else: 
  
                  H = []
                  H.append('TimeStamp')
                  H.append('Open')
                  H.append('Close')
                  H.append('Min')
                  H.append('Max')
                  H.append('Volume')
                  H.append('VolumeQuote')
  
  
  
                  with open('data'+os.sep+i+os.sep+coin_symbol+'.csv', 'w', newline="") as csvfile:
                      csvwriter = csv.writer(csvfile, delimiter=',')
                      csvwriter.writerow(H)
                  H = []
                  H.append(candle['timestamp'])
                  H.append(candle['open'])
                  H.append(candle['close'])
                  H.append(candle['min'])
                  H.append(candle['max'])
                  H.append(candle['volume'])
                  H.append(candle['volumeQuote'])
  
                  with open('data'+os.sep+i+os.sep+coin_symbol+'.csv', 'a', newline="") as csvfile:
                      csvwriter = csv.writer(csvfile, delimiter=',')
                      csvwriter.writerow(H)
  </code></pre>
  
  <p>For the Else statement, is there any way to write it differently? </p>