title: Append missing values to CSV file
body: <p>I have a sorted CSV file in following format-</p>
  
  <pre><code>X,Y
  0,0
  0,1
  0,2
  1,0
  1,1
  2,0
  2,1
  2,1
  </code></pre>
  
  <p>Here, a value <code>1,2</code> is absent. This is just a sample, my file contains a 1 million records with a few thousand absent. How can I write a script to detect and append these values to the file?</p>
  
  <p>I have tried generating all possible pairs and check if they are present in the file or not, but is way too slow-</p>
  
  <pre><code>import csv
  
  with open('myfile.csv') as csvfile:
  r = csv.reader(csvfile, delimiter=',')
  
  for row in r:
  
      for i in range(1000):
          for j in range(1000):
              if (int(row[0]) == i and int(row[1]) == j):
                  # Can perform operations here
  </code></pre>
  
  <p>Is there some way I can use Numpy or Pandas (I'm very new to those) to solve this problem?</p>