adamerose / PandasGUI

A GUI for Pandas DataFrames
MIT No Attribution
3.15k stars 226 forks source link

Pass a set of Filters to be displayed for use in checkbox window when GUI Launches #253

Closed aniforatos closed 3 months ago

aniforatos commented 3 months ago

Hello,

I would like to programmatically pass filter expressions to pandasgui so that they can be populated on the UI when I launch it.

I apologize if this is already do-able, I have been unable to find much documentation surrounding this feature.

I would like this filter to appear as soon as the window is launched so I dont have to keep re-typing it every time I launch the UI: image

aniforatos commented 3 months ago

Welp, I figured it out!

A couple of things:

The code looks like this:

df = pd.read_sql(self.get_query(), con=self.conn)
gui = pandasgui.show(df, user_feedback=self.instructions, settings={"block": False})
pgdf = gui.store.data["df"]
self.add_filters(pgdf)
gui.app.exec_()