Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-28-2020 05:14 AM
Hi all. I'm new with this neo4j and graph algorithm. So I try to use the book Graph Algorithm by Needham and Hodler to do some practical exercise. But when i run
query = """
MATCH (article:Article)
RETURN article.year AS year, count(*) AS count
ORDER BY year
"""
by_year = graph.run(query).to_data_frame()
in the neo4j browser, i got this error
Invalid input 'q': expected (line 1, column 1 (offset: 0))
"query = """"
Can anyone help to solve this?
Thanks
04-28-2020 05:07 PM
First off, welcome to the community. I'll need more info as I think we're mixing tools. If you could pass the page number in the great book or just tell me what you want to do, that'll help me help you. Running the CYPHER bit works fine. The other code is not CYPHER but does look like it could belong in something like Python or R which might be trying to run the CYPHER within that context, returning a data frame for processing. So to start with, that will not work in the Browser which got confused as it parses the letter "q". Looking forward to your clarifications and again, "welcome"!
04-28-2020 06:02 PM
Thanks llpree for your reply. Really appreciate it. For that i already solved it. I need to run in python.
But when i try to run graph.run(query).to_data_frame() in python, then i face the error. I get this error:
'NoneType' object has no attribute 'split'. (book's page no -194 & 198)
And when i passed the query about train.missing.link(pg 198) my neo4j browser become black screen.
04-29-2020 03:23 AM
The Python error indicates that the query did not get any data and hence has None as datatype. Trying to do a split for a string on a None datatype results in the error.
Sadly I don't have the book so its rather difficult to see the cause without seeing the code.
04-29-2020 03:38 AM
Thanks for your reply. Really appreciate it
Here is the screen shot of the book. Page 193 and 194.
04-29-2020 04:05 AM
Thanks for sharing, did you create the Article and Author data in the database?
I am assuming this is done earlier in the book, but if that somehow fails it would explain that the Python code does not pick up any data.
04-29-2020 04:19 AM
ya.. im using exactly the same dataset .Here the print screen for page 192
05-01-2020 12:12 AM
Found a free copy of the book, bit short on time at the moment but I will try to work through the example in the weekend. To be continued.
05-01-2020 04:24 AM
Thank you so much...
All the sessions of the conference are now available online