cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Nodes not displaying ID when creating graph DB with py2neo

Hi everyone,

I'm working with a recommender system that connects players and games (games as in matches). I started to play with py2neo trying to import a dummy DB from a csv with the following info:

|gameId|userId|
|Game1|1,2,3,6|
|Game2|1,2,5,6|
|Game3|3,4,6,7|
|Game4|3,4,2,5|

This is what I do to create the graph (constraints are already in place)

csv_players_df= pd.read_csv(path+'games-users1.csv')
tx = g.begin()
for index, row in csv_players_df.iterrows():
    tx.evaluate('''
    WITH split($userId,",") as users
    UNWIND users as user
    MERGE (p:Player {userId:user})
    MERGE (g:Game {gameId:$gameId})
    MERGE (p)-[:played_in]->(g);
    ''', parameters = {'userId': row['userId'],'gameId': row['gameId']})
tx.commit()

The code executes without any issues. However, when displaying the graph in neo4j, user ids are not displayed for the nodes. There must be something wrong with my UNWIND but I cannot figure it out.
2X_e_e3c70ab644080db3de329fdc2f60279df98451a8.png

I know userIds are correctly inserted though:
2X_0_0bb4dc2de0af71928b9532e23f0b53d128cfbd4c.png
When testing the same code directly in neo4j I see the IDs are displayed correctly:
2X_8_80b2f0b86d36b00325b06707a675a689d0cf2452.png
This is the code for neo4j:

USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM 
'file:///games-users1.csv' AS row
  WITH row, split(row.userId, ",") AS users
  UNWIND users AS user
  MERGE (p:Player {userId: user}) 
  MERGE (g:Game {gameId: row.gameId}) 
  MERGE (p)-[:played_in]->(g);

What am I missing here?
Thanks! Raul.

1 ACCEPTED SOLUTION

This just looks like a question of what to display, doesn't look like there's anything wrong with your load.

In the graph display pane, click on the label associated with the orange nodes (where it has the label name and the count of those nodes). At the bottom of the pane it should show some options of what properties to use for display. Click he userId property and the display should update accordingly.

View solution in original post

2 REPLIES 2

This just looks like a question of what to display, doesn't look like there's anything wrong with your load.

In the graph display pane, click on the label associated with the orange nodes (where it has the label name and the count of those nodes). At the bottom of the pane it should show some options of what properties to use for display. Click he userId property and the display should update accordingly.

Thanks Andrew.
feeling stupid know
I thought there was something wrong as it wasn't showing it by default