Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Qgrid Now Available in Research: An Interactive Grid for Sorting and Filtering DataFrames

Quantopian's Qgrid is a scrollable grid widget that can be used to edit sort and filter DataFrames in Jupyter notebooks. It is now available for use in the Quantopian research environment. Created as an open-source project by Quantopian's engineering team, the library has reached over 1K stars on GitHub and is used by many other organizations. Now you can use it too, right here on Quantopian.

You can think of Qgrid as an interactive alternative to the static html table that you normally see when you view a DataFrame in a notebook. By allowing you to explore your DataFrames with a simple point-and-click interface, Qgrid makes it easy for you to accomplish common data science tasks, such as:

  • Locating a particular cell in your DataFrame (without having to write any code or ctrl+F searching on the page)
  • Spot checking your data for correctness
  • Identifying the date range for which a particular data set is available

To give you an idea of what qgrid looks like in action, the following images show a DataFrame that was returned from Quantopian's Pipeline API, rendered first as a static html table, then again using qgrid.

Pipeline data, rendered without qgrid:

The same data, rendered with qgrid:

Using Qgrid in the research environment

To use qgrid in a notebook, you should import the qgrid module and call show_grid, like so:

import qgrid  
qgrid.show_grid(df)  

The best way to try out qgrid is to click the "Clone Notebook" button below to clone the attached notebook. That notebook will guide you through a few quick examples to help you get familiar with the qgrid API.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

4 responses

This is cool, and very much in the spirit of Wes McKinney. A cool feature of the data grids in Aginity (a SQL Workbench) is to grab summary statistics for each column, in this case, you could use Pandas describe(). Another cool feature is to indicate the scale of numerical quantities with an in-cell bar, so each row's scale can be compared.

Thumbs up. This interaction makes it much easier (and therefore more inclined to) look through the data for patterns and anomalies. Very cool. Thanks.

Awesome, thanks for the feedback...great to hear that people are finding it to be useful.

@Burrito Dan I hadn't looked at using pandas describe for summary stats, thanks for the suggestion. People have been requesting that we add some sort of "grand total" row (see issue #13)...this sounds similar except it in this case we'd want to show more than just one value per column.

I also like in-cell bar idea...there's a similar request open for this as well which focuses on making pandas styling functionality available in qgrid (see issue #131). I'll be sure to keep the in-cell bar use case in mind whenever I get around to working on that.

The version of Qgrid in the research environment has been upgraded to the latest version (1.1.1). This new version allows setting column-specific options, and also adds some new API methods (edit_cell, change_selection, etc) for updating the state of the grid without recreating the whole widget. In addition, this version fixes an issue that was causing performance issues and "choppiness" while scrolling.