I am running a query for a dataframe with a column of type String that returns rows that contain a certain the world ‘select’:
df.query('code.str.contains("select")')
However, when I try to run the same query in the pandasgui as a filter that takes a query expression, it is listed as a failed filter and does not evaluate it.
Query in pandasgui and columns for the dataframe
I tried a combination of "
or '
around contains, and no “` around the column name but can’t seem to find a method that enables the filter. Does anyone know if there’s a way to query a column in a dataframe through pandasgui to search a string value for a specific substring? I’d appreciate any help!
I also ended up searching through the pandasgui source code, and a good starting point would be in the pandasgui/store.py
file, where the authors used the apply_filters()
method in numerous places. It looks to me like the query is considered failed after catching an exception in the apply_filters()
method, which is where self.filters[index].failed
is set to True from False.
add_filters() method in pandasgui/store.py
swft is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1