Your code is failing because the ID for a node must be a literal (integer or string), but you set the ID as a Series when you wrote ...id = data['PMID'])
. It appears py2neo
allowed you to create the node object with a faulty ID, but it really shouldn't, because all relationships with that node will fail since the ID is bad.
Recreate the Node Classes with an integer for the ID, and then the Relationship between them should be created without issues.
Note, I haven't tested this code, but this is how you would loop through a df and create nodes as you go.
for i, row in data.iterrows():
pmid = row['PMID'] #this is the integer PMID based on your df
pmi_node = Node("PMID row " + str(i), id=pmid) #create node
authid = row['AU'] #this is a string author name based on your df
auth_node = Node("Auth row " + str(i), id=authid) #create node
graph.create(pmi_node | auth_node)
#create a relationship between the PMI and Auth for that row
graph.create(Relationship(pmi_node , "Having_author", auth_node))
PS -- The SO link you referenced is not using the py2neo
package, but is instead simply sending cypher code strings to the database using the neo4j
python package. I'd recommend this route if you are a beginner.