Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Return visible rows when grid is filtered #87

Closed
lengau opened this issue Aug 16, 2016 · 2 comments
Closed

Feature Request: Return visible rows when grid is filtered #87

lengau opened this issue Aug 16, 2016 · 2 comments

Comments

@lengau
Copy link

lengau commented Aug 16, 2016

Sometimes it's useful to use QGrid to filter several columns of a DataFrame (or perhaps sort that frame). It would be great to have a function that returns a list of indices that are visible, in visible order.

@joanabadie
Copy link

I'd like to see this feature too !
Or even better the possibility to get the displayed data directly back to pandas df.
Joan

@TimShawver
Copy link
Contributor

I've added a get_changed_df method in qgrid 1.0 which should allow you to get a filtered copy of your DataFrame. It will also reflect any sorts that have been applied, as well as edits to your cells.

See the installation instructions for the new qgrid 1.0 beta here: https://github.com/quantopian/qgrid#installation.

Also here's the documentation for the get_changed_df method: http://qgrid.readthedocs.io/en/latest/#qgrid.QgridWidget.get_changed_df

Basically you'll create a QgridWidget instance (either directly or by calling show_grid), and then call get_changed_df on that instance. Something like this:

# step 1 - first create the grid
qgrid_widget = qgrid.show_grid(df)

# step 2 - make your filtering/sorting changes and cell edits

# step 3 - in a new cell, get your changed DataFrame back
qgrid_widget.get_changed_df()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants