cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Filter through all attributes values at once

andreperez
Graph Buddy

I'm using Pandas to write some values in a CSV file, and ingesting this CSV with the Neo4J Python driver.
In order to speed up the project I'm working I setted a default value ("REPLACE_ME_PLEASE") using the Pandas fillna method to populate null values in the CSV.
Now there's only one thing left:
I can have multiple queries to search through each node label and delete this default values, but I'm looking for a query that can ignore node labels and attribute labels, and search only through attribute values.
Is this possible?

1 ACCEPTED SOLUTION

Looks a bit cumbersome, as you could have just left those values as null then they wouldn't have been added in the first place.

Depending on the size of your graph this should work:

MATCH (n)
WITH n, [k in keys(n) WHERE n[k] = 'default_value' | k] as keys
call apoc.create.removeProperties(n, keys) yield node
return count(*);

View solution in original post

2 REPLIES 2

Looks a bit cumbersome, as you could have just left those values as null then they wouldn't have been added in the first place.

Depending on the size of your graph this should work:

MATCH (n)
WITH n, [k in keys(n) WHERE n[k] = 'default_value' | k] as keys
call apoc.create.removeProperties(n, keys) yield node
return count(*);

Thank you, this works beautifully