If you want to load CSV from remote server, you need to run a simpleHTTPServer or something similar that hosts files on HTTPServer. Then you can simply use
LOAD CSV FROM "http://192.x.x.x/myfile.csv" as row
On the other hand you can import your file from a pandas dataframe. I have create a simple script that calculated linear regression gradient and saves it back to neo4j
from neo4j.v1 import GraphDatabase
import pandas as pd
import numpy as np
driver = GraphDatabase.driver("bolt://192.168.x.x:7687", auth=("neo4j", "neo4j"))
session = driver.session()
def weekly_count_gradient(data):
df = pd.DataFrame([r.values() for r in data], columns=data.keys())
df["week"] = df.start.apply(lambda x: pd.to_datetime(x).week if pd.notnull(x) else None)
df["year"] = df.start.apply(lambda x: pd.to_datetime(x).year if pd.notnull(x) else None)
group = df.groupby(["week","year","company"]).start.count().reset_index()
for name in group["company"].unique():
if group[group["company"] == name].shape[0] >= 5:
x = np.array([i[1] if i[0] == 2016 else i[1] + 52 for i in group[group.company == name][["year","week"]].values])
y = group[group.company == name]["start"].values
fit = np.polyfit(x,y,deg=1)
update = session.run("MATCH (a:Company{code:{code}}) SET a.weekly_count_gradient = toFLOAT({gradient}) RETURN a.code,{"code":name,"gradient":fit[0]})
the key here is that you run a query with parameters, and parameters can come from anywhere (list/dict/pandas)