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:
Consider the following approach:
In [44]: filters
Out[44]:
col val
0 wlbWellType EXPLORATION
1 bbb BBB
In [45]: qry = filters['col'].add(' == "').add(filters['val']).add('"').str.cat(sep=' & ')
In [46]: print(qry)
wlbWellType == "EXPLORATION" & bbb == "BBB"
slightly different syntax:
In [50]: qry = (filters['col'] + ' == "' + filters['val'] + '"').str.cat(sep=' & ')
In [51]: qry
Out[51]: 'wlbWellType == "EXPLORATION" & bbb == "BBB"'