Load data from csv with head containing parenthes

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?

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(%)`)
});

backtics

1 Like

Thanks so much for your help! It works.

1 Like