Skip to content

Instantly share code, notes, and snippets.

View adam-cowley's full-sized avatar

Adam Cowley adam-cowley

View GitHub Profile
@adam-cowley
adam-cowley / toy.cypher
Created March 9, 2023 16:26
Cypher Indexes and Constraints - Using Indexes in Neo4j - Creating Single Property Indexes
PROFILE MATCH (m:Movie)
WHERE m.title STARTS WITH "Toy"
RETURN m.title
@adam-cowley
adam-cowley / percentage-change.cypher
Created April 20, 2023 12:29
Next-level Cypher aggregations using WITH, COLLECT and UNWIND!
MATCH (u:User)-[:HAS_ENROLMENT]->(e:CompletedEnrolment)
WHERE e.completedAt >= datetime('2021-01-01')
WITH
e.completedAt.year +'-'+ e.completedAt.quarter AS quarter,
count(*) AS count
WITH collect({quarter: quarter, count: count}) AS all
UNWIND range(0, size(all)-1) AS idx
# reading CSV
import pandas as pd
csv = pd.read_csv('cluster.csv')
# connect with driver
from neo4j import GraphDatabase
driver = GraphDatabase.driver(
"neo4j+s://id.databases.neo4j.io",
("neo4j", "password")
)