cancel
Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

Can a neo4j graph projected in Python be then transformed to pandas dataframe/tensor/numpy/etc to be used with pytorch/etc.?

I'm trying to run algorithms on Neo4j's Aura DS databases.

It seems like I've by and large understood how to connect to an Aura DS database, project a particular graph, then apply one of the algorithms from the graphdatascience (GDS) library in order to do node classification or solve some other machine learning problem.

However, can I somehow connect to an Aura DS database and retrieve the data in a format like pandas dataframe/tensor/numpy array/etc. and use other libraries besides GDS to train?

Apologies if this is trivial. I've tried searching for this, but got no satisfactory answer.

3 REPLIES 3

dmitryd
Node

@doris.voina Hello!
If you using py2neo for connection to DB, you can try this py2neo export.

You can use:

* `pd.DataFrame(result.data()) 

* in the current release the python driver also has a result.to_df()

* the graph data science client returns dataframes for gds.run_cypher(query)

see our answer here in the Aura office hours

https://youtu.be/-PcjPtKgYsI?t=1686

NickM
Node

Any tips on the I think the reverse? I've got a large (2 million x 2 million) sparse matrix (from scipy) that I would like to load into neo4j.