I am trying to create a function that will allow a user to perform a Breadth-first-search in Graphframes using the .bfs method. An example function looks like:
Graphframe.bfs("name = 'Esther'", "relationship = 'friend'")
I would like a function to work like:
def friendZone(person, affiliation):
Graphframe.bfs("name = 'person'", "relationship = 'affiliation'")
I have tried using a concat method like:
'"' + "name='" + person + "'" + '"'
, but that has not worked. I also tried using
'"name={}"'.format(person).
Help please?
You can use an f-string
def friendZone(person, affiliation):
Graphframe.bfs(f"name = {person}", "relationship = {affiliation}")