title: Neo4j create nodes and relationships from pandas dataframe with py2neo
body: <p>Getting results on a pandas dataframe from a cypher query on a Neo4j database with py2neo is really straightforward, as:</p>
  
  <pre><code>&gt;&gt;&gt; from pandas import DataFrame
  &gt;&gt;&gt; DataFrame(graph.data("MATCH (a:Person) RETURN a.name, a.born LIMIT 4"))
     a.born              a.name
  0    1964        Keanu Reeves
  1    1967    Carrie-Anne Moss
  2    1961  Laurence Fishburne
  3    1960        Hugo Weaving
  </code></pre>
  
  <p>Now I am trying to create (or better MERGE) a set of nodes and relationships from a pandas dataframe into a Neo4j database with py2neo. Imagine I have a dataframe like:</p>
  
  <pre><code>LABEL1 LABEL2
  p1 n1
  p2 n1
  p3 n2
  p4 n2
  </code></pre>
  
  <p>where Labels are column header and properties as values. I would like to reproduce the following cypher query (for the first row as example), for every rows of my dataframe:</p>
  
  <pre><code>query="""
      MATCH (a:Label1 {property:p1))
      MERGE (a)-[r:R_TYPE]-&gt;(b:Label2 {property:n1))
  """
  </code></pre>
  
  <p>I know I can tell py2neo just to <code>graph.run(query)</code>, or even run a <code>LOAD CSV</code> cypher script in the same way, but I wonder whether I can iterate through the dataframe and apply the above query row by row WITHIN py2neo.</p>