title: Querying csv files in python like sql
body: <p>This is apparently a popular interview question.<br />
  There are 2 CSV files with dinosaur data. We need to query them to return dinosaurs satisfying a certain condition.</p>
  <p>Note - We cannot use additional modules like q, fsql, csvkit etc.</p>
  <p>file1.csv:</p>
  <pre><code>NAME,LEG_LENGTH,DIET
  Hadrosaurus,1.2,herbivore
  Struthiomimus,0.92,omnivore
  Velociraptor,1.0,carnivore
  Triceratops,0.87,herbivore
  Euoplocephalus,1.6,herbivore
  Stegosaurus,1.40,herbivore
  Tyrannosaurus Rex,2.5,carnivore
  </code></pre>
  <p>file2.csv</p>
  <pre><code>NAME,STRIDE_LENGTH,STANCE
  Euoplocephalus,1.87,quadrupedal
  Stegosaurus,1.90,quadrupedal
  Tyrannosaurus Rex,5.76,bipedal
  Hadrosaurus,1.4,bipedal
  Deinonychus,1.21,bipedal
  Struthiomimus,1.34,bipedal
  Velociraptor,2.72,bipedal
  </code></pre>
  <p>using the forumla :
  speed = ((STRIDE_LENGTH / LEG_LENGTH) - 1) * SQRT(LEG_LENGTH * g), where g = 9.8 m/s^2</p>
  <p>Write a program to read csv files, and print only names of bipedal dinosaurs, sorted by speed from fastest to slowest.</p>
  <p>In SQL, this would be simple:</p>
  <pre><code>select f2.name from
  file1 f1 join file2 f2 on f1.name = f2.name
  where f1.stance = 'bipedal'
  order by (f2.stride_length/f1.leg_length - 1)*pow(f1.leg_length*9.8,0.5) desc
  </code></pre>
  <p>How can this be done in python ?</p>