Import csv or api data in python using apoc.periodic.iterate

Just few questions since I can not find any issue about them. The following is my query that can work in Neo4j server

CALL apoc.periodic.iterate("CALL apoc.load.csv('file:///import/data') YIELD map AS row RETURN row",

'CREATE (computer:Computer{computer:coalesce(row.Computer,"No Computer")})',

{batchSize:10000, iterateList:true, parallel:true})

Can this query work in Python, i.e., can apoc.periodic.iterate and apoc.load.csv both work in Python?

Moreover, if I import my data into Python (for example, panda-dataframe), can apoc.periodic.iterate work in Python without the help of apoc.load.csv?

Appreciate.

I don’t see why it wouldn’t work as long as you have the apoc plug-in installed your server. The python driver will send the query to the server for execution.

you could convert the data frame data into a list of dictionaries and pass the list as a parameter to perodic.iterate. The first query in perodic.iterate would consist of an ‘unwind’ followed by a ‘return’, resulting in rows of maps, one from each row of the data frame. The second query in perodic.iterate would process each map in batches.