Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

创建关系的时候报错AttributeError: 'NoneType' object has no attribute 'labels' #6

Open
mf093087 opened this issue Mar 8, 2022 · 5 comments

Comments

@mf093087
Copy link

mf093087 commented Mar 8, 2022

在这一步,报错。
matcher = NodeMatcher(graph)
for i in holder.values:
a = matcher.match("股票",TS代码=i[0]).first()
b = matcher.match("股东",TS代码=i[0])
for j in b:
r = Relationship(j,'参股',a)
graph.create(r)
print('TS',str(i[0]))

graph.create(Relationship(j,'参股',a))
File "E:\Anaconda3\lib\site-packages\py2neo\data.py", line 847, in init
Entity.init(self, (n[0], self, n[1]), properties)
File "E:\Anaconda3\lib\site-packages\py2neo\data.py", line 553, in init
Walkable.init(self, iterable)
File "E:\Anaconda3\lib\site-packages\py2neo\data.py", line 453, in init
_ = node.labels # ensure not stale
AttributeError: 'NoneType' object has no attribute 'labels'

Process finished with exit code 1

@ShaoaAllen
Copy link

你好,我也是和你同样的问题,请问怎么解决呢

@alwaysinfire
Copy link

+1

@lzh1998-jansen
Copy link

请问解决了吗?

@Ya-Suan
Copy link

Ya-Suan commented Apr 7, 2023

+1,请问怎么解决呀

@rainingstar
Copy link

我是把代码改成了
for i in stock.values:
a = matcher.match("股票" ,TS代码=i[1]).first()
b = matcher.match("股东" ,TS代码=i[1])
for j in b:
r = Relationship(j ,'参股' ,a)
graph.create(r)
print("TS代码为" + i[1] + "的股票与股东的关系建立成功")
主要是1)在stock_holders.csv里面,TS代码在第二列也就是i[1]
2)如果遍历holder的话要跑16万(i的个数,stock_holders.csv的条目数)*16万(j的个数,股东实体的个数)次,慢的要死;遍历stock是一样的,但是只用跑4千(i的个数,stock_basic.csv的条目数)*16万次

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants