Hi all, The problem is related to the Python backlash error. I am creating a dynamic query string for filtering in pandas. The code is:
The reason is that you are wrapping your key in python format string ( "'{}'".format ) as well. Try this solution:
query_string = ""
index = 0
for (k,v) in filters.iteritems():
for i in v:
if (index == 0):
query_string += str(k) + " == " + "'{}'".format(i)
else:
query_string += " & " + str(k) + " == " + "'{}'".format(i)
index += 1