Query problem in Graph Algorithm Book

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
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?

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"!

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.

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.

Thanks for your reply. Really appreciate it
Here is the screen shot of the book. Page 193 and 194.


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.

ya.. im using exactly the same dataset .Here the print screen for page 192

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.

Thank you so much... :innocent: :innocent: