I'm using py2neo
in Python to run my Cypher queries.
I'm trying to create Person nodes and relationships between then.
My DataFrame is like this:
df
>>> id_user name follows.profiles
a_123 Mc Marcão <3 [a_134, a_934, a_145, a_988]
a_234 john a_111
a_934 alice NaN
: : :
: : :
So here we can see that a Person can follows multiple persons, because follows.profiles
is a list.
So this is what I did:
for index, row in df.iterrows():
graph.run('''
UNWIND $label3 as follow_profile
MERGE (p1:Profile { id_user: $label1, name: $label2 })
MERGE (p1)-[:FOLLOWS]->(p2:Profile { id_user: follow_profile })
''', parameters = {'label1': row['id_user'],
'label2': row['name'],
'label3': row['follows.profiles']
})
So the nodes are created and their relationships too. Now I want to set labels to the nodes relateds. How can I do this?