Python and Neo4jΒΆ

Py2neo is a client library and toolkit for working with Neo4j from within Python applications and from the command line. The library supports both Bolt and HTTP and provides a high level API.

pip install py2neo

Documentation : https://py2neo.org/v4/

../_images/py2neo.png
from py2neo import Graph
graph = Graph("bolt://localhost:7687",password="xxxx",name="yyyy")

Where yyyy is the name of the database and xxxx is the password

In the graph we can run the different cypher commands and sent the put to for example a dataframe (connecting to our game of thrones database):

result=graph.run("match (n)-[r]->(p) return n.name")
df = result.to_data_frame()
df.head(5)

Which results in :

../_images/py2neo1.png

Last change: Oct 30, 2023