title: How to execute query in Python when list in SQL query as parameter
body: <p>I have a list with three elements in it and I want to iterate over the list to execute query one after another element in the list. For example, </p>
  
  <pre><code>zipcode_list = ['10000', '10018', '11201'] 
  sql = "SELECT name, zipcode, state FROM survey WHERE zipcode IN (%s)"
  </code></pre>
  
  <p>I want to execute query <code>"SELECT name, zipcode, state FROM survey WHERE zipcode IN 1000"</code>first, and then <code>"SELECT name, zipcode, state FROM survey WHERE zipcode IN 10018"</code> and last query <code>"SELECT name, zipcode, state FROM survey WHERE zipcode IN 11201"</code></p>
  
  <p>I also want to put the retrieved data in 3 separate dataframes. Here's how I executed the query,</p>
  
  <pre><code>zipcode_list = ['10000', '10018', '11201']
  sql = "SELECT name, zipcode, state FROM survey WHERE zipcode IN (%s)"    
  in_p = ', '.join(list(map(lambda x: '%s', zipcode_list)))
  sql = sql % in_p
  df = cursor.execute(sql, zipcode_list).fetchall()
  for dfs in df:
      df = pd.DataFrame(df)
  </code></pre>