I have a csv
file wherein some fields are array-types. Fields are separated with ,
and array items are separated with ;
. For example:
index, name, friends, neighbors
0,Jim,John;Tim;Fred,Susan;Megan;Cheryl
1,Susan,Jim;John,Megan;Cheryl
2,Sean,,,
where Jim
has three friends, John
, Tim
, and Fred
, and three neighbors, Susan
, Megan
, and Cheryl
, and Sean
has no friends and no neighbors.
However, when I read this into neo4j
using apoc.load.csv
, I end up with list properties with empty strings inside of them (rather than empty lists). For example:
CALL apoc.periodic.iterate("
CALL apoc.load.csv('file.csv',
{header:true,sep:',',
mapping:{
friends:{array:true},
neighbors:{array:true}}
})
YIELD map as row RETURN row
","
CREATE (p:Person) SET p = row
",
{batchsize:50000, iterateList:true, parallel:true});
Gives me a Person
with name Sean
but with friends=[ "" ]
and neighbors=[ "" ]
.
What I want is Sean
to have friends=[]
and neighbors=[]
.
Thank you!