When I import data to neo4j I got this error "AttributeError: 'NodeMatch' object has no attribute 'exists' "

124 views Asked by At

The error is here

result1 = matcher.match("regain", name=str(date_time[0])).exists()
**This is my code:**

 
import pandas as pd

from py2neo import Graph, Node, Relationship, NodeMatcher

graph = Graph("http://localhost:7474", username="neo4j", password='123456')
matcher = NodeMatcher(graph)

path = 'testdata.csv'
dates = pd.read_csv(path, names=['Head', 'Tail', 'none', 'fence', 'type'], header=None)
print(dates)

for ii in dates.index:
    date_time = dates.loc[ii].values

    result1 = matcher.match("regain", name=str(date_time[0])).exists() 
    if not result1:
       
        head = Node("regain", name=str(date_time[0]))
        graph.create(head)
    else:
        head = matcher.match("regain").where(name=str(date_time[0])).first()

    result2 = matcher.match("regain", name=str(date_time[1])).exists() 
        
        
0

There are 0 answers