Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-23-2022 02:07 AM
ClientError: {code: Neo.ClientError.Statement.SemanticError} {message: Cannot merge the following node because of null property value for 'scope': (:scope {scope: null})}
"LOAD CSV WITH HEADERS FROM $path AS row "
"MERGE (sc:scope {scope: row.Scope_name}) "
"SET sc.Chinese_name = row.Chinese, sc.English_name = row.English "
Please, what could I be missing?
#CSV #neo4J
Solved! Go to Solution.
11-23-2022 02:39 AM
Hi,
this is a quite annoying error in the beginning if you don't know it but quite easy to solve. It means that there is an entry in your csv file that is null. Does your csv file maybe look something like this:
Chinese,English
name1,name2
name3,name4
,
,
i.e. there are additional empty lines at the bottom? Or maybe like this:
Chinese,English
name1,name2
name3,name4
,name5
name6,
i.e. there are some empty "cells" somewhere? Then this error occurs. Tipp: Don't look at the file in Excel, rather look at it in a text editor (e.g. Notepad++) because you won't see the empty lines in Excel.
In the first step have a look at your files and clean them up. There should be no empty lines at the bottom. But if there are cases where empty cells are ok and you specifically don't want to fill them in your csv file, you can use the coalesce function:
SET sc.Chinese_name = COALESCE(row.Chinese,"No Chinese Name"), sc.English_name = COALESCE(row.English,"No English Name")
It will then replace any null value it encounters in a column with the value that you give as the second argument (here e.g. "No Chinese Name").
Regards,
Elena
11-23-2022 02:39 AM
Hi,
this is a quite annoying error in the beginning if you don't know it but quite easy to solve. It means that there is an entry in your csv file that is null. Does your csv file maybe look something like this:
Chinese,English
name1,name2
name3,name4
,
,
i.e. there are additional empty lines at the bottom? Or maybe like this:
Chinese,English
name1,name2
name3,name4
,name5
name6,
i.e. there are some empty "cells" somewhere? Then this error occurs. Tipp: Don't look at the file in Excel, rather look at it in a text editor (e.g. Notepad++) because you won't see the empty lines in Excel.
In the first step have a look at your files and clean them up. There should be no empty lines at the bottom. But if there are cases where empty cells are ok and you specifically don't want to fill them in your csv file, you can use the coalesce function:
SET sc.Chinese_name = COALESCE(row.Chinese,"No Chinese Name"), sc.English_name = COALESCE(row.English,"No English Name")
It will then replace any null value it encounters in a column with the value that you give as the second argument (here e.g. "No Chinese Name").
Regards,
Elena
11-23-2022 04:02 AM
Thanks, Elena for the explanation.
11-23-2022 04:38 AM
#For others who may face a similar problem
*Another approach is to remove the commas at the endings of the words in the columns (Dataframe) during data cleaning:
#removing comma at the end of the words
df["Column_name"]=df['Column_name'].str.rstrip(',')
All the sessions of the conference are now available online