Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-13-2020 02:07 PM
I want to load data from the local file .csv.
I wrote the cypher as follows,
LOAD CSV WITH HEADERS FROM url AS line With line CREATE (accident:Accident {identify:line.ID,zipcode:line.Zipcode,humidity:TOFLOAT(line.Humidity)})
But the Humidity column in the .csv is Humidity(%), so how do I process the property humidity when I load data from the local file.
If I wrote like this,
LOAD CSV WITH HEADERS FROM url AS line With line CREATE (accident:Accident {identify:line.ID,zipcode:line.Zipcode,humidity:TOFLOAT(line.Humidity(%))})
It is not right.
How to troubleshoot this problem?
04-13-2020 04:39 PM
Hi,
You should surround the field names with backticks like this.
`Humidity(%)`
This is the sample.csv file.
"ID","Zipcode","Humidity(%)"
1,123456,10.1
2,789012,50.9
3,456789,12.8
LoadCSV Cypher
LOAD CSV WITH HEADERS FROM 'file:///sample.csv' AS line
CREATE (:Sample {
id: line.ID,
zipcode: line.Zipcode,
humidity: toFloat(line.`Humidity(%)`)
});
04-13-2020 05:47 PM
Thanks so much for your help! It works.
All the sessions of the conference are now available online