Giter VIP home page Giter VIP logo

Comments (5)

lkursell avatar lkursell commented on July 18, 2024 1

Would it be possible to return a dataframe of the filtered table?

from qgrid.

TimShawver avatar TimShawver commented on July 18, 2024

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.

klonuo avatar klonuo commented on July 18, 2024

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.

TimShawver avatar TimShawver commented on July 18, 2024

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.

TimShawver avatar TimShawver commented on July 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.