Last active
January 11, 2022 23:49
-
-
Save jalakoo/1975d78ff7e6eb7a0c054ac34b9c27c0 to your computer and use it in GitHub Desktop.
discoveraurafree - week 1 - load data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/fivethirtyeight/data/master/nba-elo/nbaallelo.csv" AS row | |
//skipping doubles, also Aura Free limit of 50k nodes, ~ 100 teams | |
WITH row LIMIT 99900 WHERE row._iscopy="0" | |
MERGE (ht:Team {code:row.team_id}) | |
ON CREATE SET ht.name = row.fran_id | |
MERGE (at:Team {code:row.opp_id}) | |
ON CREATE SET at.name = row.opp_fran | |
CREATE (m:Match {id:row.game_id, venue:right(row.game_id, 3), date:row.date_game}) | |
WITH ht, at, m, row.pts AS hpoints, row.opp_pts AS apoints, | |
row.elo_i AS hse, row.elo_n AS hee, row.opp_elo_i AS ase, | |
row.opp_elo_n AS aee | |
CREATE (ht)-[:PLAYED_IN {points:hpoints, startElo:hse, endElo:hee}]->(m) | |
CREATE (at)-[:PLAYED_IN {points:apoints, startElo:ase, endElo:aee}]->(m) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment