Comments (5)
Would it be possible to return a dataframe of the filtered table?
from qgrid.
Hi, thanks for filing this. I'll look into it as soon as I can but I'm going to finish up #4 first.
If you take a look at the Michael Leibman's reply about copy/paste, it sounds like it might require Flash (gasp) to for me to write things to the clipboard. That being said, I just tried copying/pasting from an html table on a different site and pasting into my text editor and it worked really well. SlickGrid is not a normal html table (it's all divs), but the browser should also be able to copy text out of divs. So in theory this should be doable, it'll just take a little investigation to figure out what's preventing the copying.
What would you being doing with the data, pasting to a spreadsheet? Or do you just need the text in the cells for a text editor? The reason I ask is I'm wondering whether an "export selection to CSV" feature would be a better solution for you. That also might be easier to implement than copying to the clipboard.
from qgrid.
Yes, feature #4 would be great addon.
As we can put any data in pandas dataframe, these live filters are so to the point. While I was enjoying this extension, I wanted to copy some filtered data in a text editor, but copying data from filtered table has I guess general usage scenarios. "export selection to CSV" is fine by me. It's same as regular table copy/paste, just instead tabs we'll get commas.
Thanks for your consideration
from qgrid.
Cool, I'll try to get to this soon. In the meantime I committed changed a setting in SlickGrid to allow some primitive dragging and copying. It doesn't copy the data in a nice format...when you later paste the data all the values are smushed together. It was just a one line change so I figured it was better than no copying at all.
from qgrid.
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()
If you want to get this DataFrame in csv form, you can do that by calling to_csv
on the DataFrame instance, and then copying the text that gets printed out. One caveat to be aware of is to_csv
will likely crash your browser for very large DataFrames, so you'll probably want to specify a file path for to_csv
, so that it's output goes directly to a file rather than to the browser.
from qgrid.
Related Issues (20)
- Set Formatter for Column Definitions
- AttributeError: 'DataFrame' object has no attribute 'map'
- [Security] Workflow main.yml is using vulnerable action actions/checkout
- missing 1 required positional argument: 'widget' HOT 3
- qgrid not working in Binder notebook
- update for ipywidgets 8 compatibility HOT 1
- qgrid post link fails on environment build HOT 2
- REPO IS NO LONGER MAINTAINED AND DOES NOT SUPPORT JUPYTERLAB>=3.0.0 HOT 8
- QGrid is not working with NB-viewer.
- Internet connection required for qgrid 1.1.3 HOT 1
- Here, working version HOT 12
- filter_changed is not recognised in .on() HOT 1
- "ImportError: cannot import name 'Mapping' from 'collections' (C:\ProgramData\anaconda3\lib\collections\__init__.py)"
- post-link script failed for package conda-forge::qgrid-1.3.1-py39hcbf5309_2
- Filter not working HOT 1
- Detecting row selected in Python shiny
- Cannot edit the table using responsive setting
- Introducing QgirdNext: bug fixes and compatibility improvements HOT 1
- Polars Support
- Integrating width VTable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qgrid.