Giter VIP home page Giter VIP logo

qgrid's Introduction

qgrid

qgrid

Qgrid is a Jupyter notebook widget which uses SlickGrid to render pandas DataFrames within a Jupyter notebook. This allows you to explore your DataFrames with intuitive scrolling, sorting, and filtering controls, as well as edit your DataFrames by double clicking cells.

Qgrid was developed for use in Quantopian's hosted research environment and is available for use in that environment as of June 2018. Quantopian also offers a fully managed service for professionals that includes Qgrid, Zipline, Alphalens, Pyfolio, FactSet data, and more.

Announcements: Qgrid Webinar

Qgrid author Tim Shawver recently did a live webinar about Qgrid, and the recording of the webinar is now available on YouTube.

This talk will be interesting both for people that are new to Qgrid, as well as longtime fans that are interested in learning more about the project.

Demo

Click the badge below to try out the latest beta of qgrid in Quantopian's hosted research environment. If you're already signed into Quantopian you'll be brought directly to the demo notebook. Otherwise you'll be prompted to register (it's free):

image

Click the badge below to try out qgrid using binder:

image

Click the following badge to try out qgrid in Jupyterlab, also using binder:

image

For both binder links, you'll see a brief loading screen while a server is being created for you in the cloud. This shouldn't take more than a minute, and usually completes in under 10 seconds.

The binder demos generally will be using the most recent stable release of qgrid, so features that were added in a recent beta version may not be available in those demos.

For people who would rather not go to another page to try out qgrid for real, here's the tldr; version:

A brief demo showing filtering, editing, and the get_changed_df() methodA brief demo showing filtering, editing, and the get_changed_df() method

API Documentation

API documentation is hosted on readthedocs.

Installation

Installing with pip:

pip install qgrid
jupyter nbextension enable --py --sys-prefix qgrid

# only required if you have not enabled the ipywidgets nbextension yet
jupyter nbextension enable --py --sys-prefix widgetsnbextension

Installing with conda:

# only required if you have not added conda-forge to your channels yet
conda config --add channels conda-forge

conda install qgrid

Jupyterlab Installation

First, go through the normal installation steps above as you normally would when using qgrid in the notebook. If you haven't already install jupyterlab and enabled ipywidgets, do that first with the following lines:

pip install jupyterlab
jupyter labextension install @jupyter-widgets/jupyterlab-manager

Install the qgrid-jupyterlab extension and enable:

jupyter labextension install qgrid2

At this point if you run jupyter lab normally with the 'jupyter lab' command, you should be able to use qgrid in notebooks as you normally would.

Please Note: Jupyterlab support has been tested with jupyterlab 0.30.5 and jupyterlab-manager 0.31.3, so if you're having trouble, try installing those versions. Feel free to file an issue if you find that qgrid isn't working with a newer version of either dependency.

What's New

Column-specific options (as of 1.1.0): Thanks to a significant PR from the community, Qgrid users now have the ability to set a number of options on a per column basis. This allows you to do things like explicitly specify which column should be sortable, editable, etc. For example, if you wanted to prevent editing on all columns except for a column named 'A', you could do the following:

col_opts = { 'editable': False }
col_defs = { 'A': { 'editable': True } }
qgrid.show_grid(df, column_options=col_opts, column_definitions=col_defs)

See the updated show_grid documentation for more information.

Disable editing on a per-row basis (as of 1.1.0): This feature can be thought of as the first row-specific option that qgrid supports. In particular it allows a user to specify, using python code, whether or not a particular row should be editable. For example, to make it so only rows in the grid where the 'status' column is set to 'active' are editable, you might use the following code:

def can_edit_row(row):
    return row['status'] == 'active'

qgrid.show_grid(df, row_edit_callback=can_edit_row)

New API methods for dynamically updating an existing qgrid widget (as of 1.1.0): Adds the following new methods, which can be used to update the state of an existing Qgrid widget without having to call show_grid to completely rebuild the widget:

Improved MultiIndex Support (as of 1.0.6-beta.6): Qgrid now displays multi-indexed DataFrames with some of the index cells merged for readability, as is normally done when viewing DataFrames as a static html table. The following image shows qgrid displaying a multi-indexed DataFrame that was returned from Quantopian's Pipeline API:

Dependencies

Qgrid runs on Python 2 or 3. You'll also need pip for the installation steps below.

Qgrid depends on the following three Python packages:

Jupyter notebook

This is the interactive Python environment in which qgrid runs.

ipywidgets

In order for Jupyter notebooks to be able to run widgets, you have to also install this ipywidgets package. It's maintained by the Jupyter organization, the same people who created Jupyter notebook.

Pandas

A powerful data analysis / manipulation library for Python. Qgrid requires that the data to be rendered as an interactive grid be provided in the form of a pandas DataFrame.

These are listed in requirements.txt and will be automatically installed (if necessary) when qgrid is installed via pip.

Compatibility

qgrid IPython / Jupyter notebook ipywidgets Jupyterlab

0.2.0

2.x N/A N/A

0.3.x

3.x N/A N/A

0.3.x

4.0 4.0.x N/A

0.3.x

4.1 4.1.x N/A

0.3.2

4.2 5.x N/A

0.3.3

5.x 6.x N/A

1.0.x

5.x 7.x 0.30.x

Running the demo notebooks locally

There are a couple of demo notebooks in the qgrid-notebooks repository which will help you get familiar with the functionality that qgrid provides. Here are the steps to clone the qgrid-notebooks repository and open a demo notebook:

  1. Install qgrid by following the instructions in the Installation section above, if you haven't already
  2. Clone the qgrid-notebooks repository from GitHub:

    git clone https://github.com/quantopian/qgrid-notebooks.git
  3. Install the dev requirements for the repository and start the notebook server:

    cd qgrid-notebooks
    pip install -r requirements_dev.txt
    jupyter notebook
  4. Click on one of the two notebooks (index.ipynb or experimental.ipynb) that you see listed in the notebook UI in your browser.

Running from source & testing your changes

If you'd like to contribute to qgrid, or just want to be able to modify the source code for your own purposes, you'll want to clone this repository and run qgrid from your local copy of the repository. The following steps explain how to do this.

  1. Clone the repository from GitHub and cd into the top-level directory:

    git clone https://github.com/quantopian/qgrid.git
    cd qgrid
  2. Install the current project in editable mode:

    pip install -e .
  3. Install the node packages that qgrid depends on and build qgrid's javascript using webpack:

    cd js && npm install .
  4. Install and enable qgrid's javascript in your local jupyter notebook environment:

    jupyter nbextension install --py --symlink --sys-prefix qgrid && jupyter nbextension enable --py --sys-prefix qgrid
  5. If desired, install the labextension:

    jupyter labextension link js/
  6. Run the notebook as you normally would with the following command:

    jupyter notebook

Manually testing server-side changes

If the code you need to change is in qgrid's python code, then restart the kernel of the notebook you're in and rerun any qgrid cells to see your changes take effect.

Manually testing client-side changes

If the code you need to change is in qgrid's javascript or css code, repeat step 3 to rebuild qgrid's npm package, then refresh the browser tab where you're viewing your notebook to see your changes take effect.

Running automated tests

There is a small python test suite which can be run locally by running the command pytest in the root folder of the repository.

Building docs

The read-the-docs page is generated using sphinx. If you change any doc strings or want to add something to the read-the-docs page, you can preview your changes locally before submitting a PR using the following commands:

pip install sphinx sphinx_rtd_theme
cd docs && make html

This will result in the docs/_build/html folder being populated with a new version of the read-the-docs site. If you open the index.html file in your browser, you should be able to preview your changes.

Events API

As of qgrid 1.0.3 there are new on and off methods in qgrid which can be used to attach/detach event handlers. They're available on both the qgrid module (see qgrid.on), and on individual QgridWidget instances (see qgrid.QgridWidget.on). Previously the only way to listen for events was to use undocumented parts of the API.

Having the ability to attach event handlers allows us to do some interesting things in terms of using qgrid in conjunction with other widgets/visualizations. One example is using qgrid to filter a DataFrame that's also being displayed by another visualization.

If you previously used the observe method to respond to qgrid events, lets see how your code might be updated to use the new on method:

# Before upgrading to 1.0.3
def handle_df_change(change):
    print(change['new'])

qgrid_widget.observe(handle_df_change, names=['_df'])

When you upgrade to 1.0.3, you have more granular control over which events you do an don't listen to, but you can also replicate the previous behavior of calling print every time the state of the internal DataFrame is changed. Here's what that would look like using the new on method:

# After upgrading to 1.0.3
def handle_json_updated(event, qgrid_widget):
    # exclude 'viewport_changed' events since that doesn't change the DataFrame
    if (event['triggered_by'] != 'viewport_changed'):
        print(qgrid_widget.get_changed_df())

qgrid_widget.on('json_updated', handle_json_updated)

See the events notebook for more examples of using these new API methods.

For people who would rather not go to another page to try out the events notebook, here are a couple of gifs to give you an idea of what you can do with it.

The first gif shows how you can use qgrid to filter the data that's being shown by a matplotlib scatter plot:

A brief demo showing qgrid hooked up to a matplotlib plotA brief demo showing qgrid hooked up to a matplotlib plot

The second gif shows how you can move qgrid to a separate view in JupyterLab, which makes it more convenient to use in conjunction with other visualizations (in this case, a couple of Output widgets):

A brief demo showing qgrid's events apiA brief demo showing qgrid's events api

Continuing to use qgrid 0.3.3

If you're looking for the installation and usage instructions for qgrid 0.3.3 and the sample notebook that goes along with it, please see the qgrid 0.3.3 tag in this repository. The installation steps will be mostly the same. The only difference is that when you run "pip install" you'll have to explicitly specify that you want to install version 0.3.3, like this:

pip install qgrid==0.3.3

If you're looking for the API docs, you can find them on the readthedocs page for qgrid 0.3.3.

If you're looking for the demo notebook for 0.3.3, it's still availabe in nbviewer.

Qgrid 0.3.3 is not compatible with ipywidgets 7, so if you need support for ipywidgets 7, you'll need to use qgrid 1.0.

Contributing

All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome. See the Running from source & testing your changes section above for more details on local qgrid development.

If you are looking to start working with the qgrid codebase, navigate to the GitHub issues tab and start looking through interesting issues.

Feel free to ask questions by submitting an issue with your question.

qgrid's People

Contributors

andyfaff avatar babymastodon avatar blink1073 avatar consideratio avatar djchou avatar fawce avatar fhgd avatar greenberga avatar henryiii avatar hottwaj avatar itcarroll avatar rdhyee avatar richafrank avatar richlysakowski avatar sergiuser1 avatar snth avatar ssanderson avatar timshawver avatar tobias-aam avatar toddrme2178 avatar willcrichton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qgrid's Issues

Possible install issue with an existing Anaconda environment

Hello, this is a partial bug message, I figured it was worth filing in case others have a similar issue. I have an existing Python 3.4 Anaconda environment called "scratch" (I use it for all side projects). It has numpy, pandas, IPython Notebook and lots more.

I already had a version of qgrid from at least 6 months back, installed back in the mists of time.

I just tried pip install -U git+https://github.com/quantopian/qgrid (adding -U to your install notes) and it had a crack at uninstalling my Anaconda-provided numpy+pandas+notebook. I killed it and thankfully it hadn't nuked my environment.

I cloned your repo locally and edited setup.py to remove the install_requires dependencies, then ran python setup.py install and I have the latest version. I'm not sure what happened but I figure it is worth noting (but feel free to close/delete if this isn't a helpful-enough bug report!).

store the filtered grid in new dataframe

Hello,
is this scenario possible:

df_new = qgrid.show_grid(df, remote_js = True)

plt.scatter(df_new.index, dataframe['Col'])

In the essence, it would be great to have the df_new and the plot created from it updated interactively.

Release show_toolbar

As far as I can see, the show_toolbar option isn't available on the latest released version. Could you do another release?

Making edits permanent

How to make edits permanent? The demo notebook suggests a grid is editable by default, and that the dataframe is updated.

I may be missing something very obvious but I can't seem to make my edits to a dataframe permanent using qgrid . I'm basically following he demo notebook. The dataframe displays nicely when I call

qgrid.show_grid(df)

I can click on cells to change values. Those new values continue to display in that grid as I move around. However when I run the code to display the same dataframe again from the same cell for from a cell lower down in my notebook, all my edits appear to be lost. I just see the content of the original dataframe.

Is there some setting I need to change? The qgrid documentation states these settings are passed to slickgrid

{
    'fullWidthRows': True,
    'syncColumnCellResize': True,
    'forceFitColumns': True,
    'rowHeight': 28,
    'enableColumnReorder': False,
    'enableTextSelectionOnCells': True,
    'editable': True,
    'autoEdit': False
}

Should any of these be different?

Show a multi-indexed column

Hi,

Is it possible to show a DataFrame where the columns are a MultiIndex such as:

          A                             C                    
          1         2         3         1         2         3
X -0.890096  0.076550 -0.686891  0.985743 -0.426691 -0.577464
Y -1.059743 -2.835858 -0.389842 -0.316724  0.102168 -0.932888

Thanks,
Damien G.

Get error: 'No such comm target registered: jupyter.widget.version'

I have the following:

jupyter==1.0.0
jupyter-client==4.2.2
jupyter-console==4.1.1
jupyter-core==4.1.0
ipywidgets==4.1.1
widgetsnbextension==1.2.3

When I try to run the 5 cell in the demo notebook I got
[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.version

Export to an HTML file

It might be nice to be able to spit out a separate HTML file that works independently of the notebook. This would allow one to share the HTML file easily without requiring iPython/Jupyter.

Jupyter kernel crashes

I am using Python 2.7.8 and Jupyter 4.0.6 on CENTOS 6. I use the following code to render qgrid.
"import qgrid
qgrid.show_grid(df)"

In some cases it works with no issue. Although with wider df's I get a "kernel restarting" error on Jupyter which states "The kernel appears to have died. It will restart automatically". This is the only time I've had this occur on Jupyter (when I use qgrid).
I was able to fix this by changing my PANDAS dataframe column types FROM 'category'. It seems qgrid crashes when trying to render PANDAS 'category' data types?

Further, with PANDAS datetime column types, it does not display the 'time' part of the field.

pip install qgrid Broken.

Collecting qgrid
Downloading qgrid-0.3.1.tar.gz (71kB)
100% |████████████████████████████████| 81kB 300kB/s
Requirement already up-to-date: notebook==4.1.0 in /usr/lib/python2.7/site-packages (from qgrid)
Collecting pandas==0.17.1 (from qgrid)
Downloading pandas-0.17.1.zip (7.7MB)
17% |█████▌ | 1.3MB 97kB/s eta 0:01:06^Z
[1]+ Stopped pip install --upgrade qgrid

I have pandas 18.1 installed qgrid is downgrading pandas... please fix.

pip list
pandas (0.18.1)

Autofilter Scroll

Is it possible to scroll within the autofilter selection page? i.e. when i select the autofilter, only a subset of the items in the column are listed and there does not appear to be a way to scroll within that list.

Qgrid are not displayed on jupyterhub when using runipy to run ipynb file

I am using runipy to run a ipython notebook and save the notebook output as a new notebook. Qgrid is working properly when running notebook on jupyterhub, but doesn't work when using runipy. Code is executed properly, only qgrid is not displayed instead it displays following

var path_dictionary = { jquery_drag: "https://cdn.rawgit.com/quantopian/qgrid/72d356cb123fab413dba73ec46616e4916fbd827/qgrid/qgridjs//lib/jquery.event.drag-2.2", slick_core: "https://cdn.rawgit.com/quantopian/qgrid/72d356cb123fab413dba73ec46616e4916fbd827/qgrid/qgridjs//lib/slick.core.2.2", slick_data_view: "https://cdn.rawgit.com/quantopian/qgrid/72d356cb123fab413dba73ec46616e4916fbd827/qgrid/qgridjs//lib/slick.dataview.2.2", slick_check_box_column: "https://cdn.rawgit.com/quantopian/qgrid/72d356cb123fab413dba73ec46616e4916fbd827/qgrid/qgridjs//lib/slick.checkboxselectcolumn", slick_row_selection_model: "https://cdn.rawgit.com/quantopian/qgrid/72d356cb123fab413dba73ec46616e4916fbd827/qgrid/qgridjs//lib/slick.rowselectionmodel", slick_grid: "https://cdn.rawgit.com/quantopian/qgrid/72d356cb123fab413dba73ec46616e4916fbd827/qgrid/qgridjs//lib/slick.grid.2.2", data_grid: "https://cdn.rawgit.com/quantopian/qgrid/72d356cb123fab413dba73ec46616e4916fbd827/qgrid/qgridjs//qgrid", date_filter: "https://cdn.rawgit.com/quantopian/qgrid/72d356cb123fab413dba73ec46616e4916fbd827/qgrid/qgridjs//qgrid.datefilter", slider_filter: "https://cdn.rawgit.com/quantopian/qgrid/72d356cb123fab413dba73ec46616e4916fbd827/qgrid/qgridjs//qgrid.sliderfilter", text_filter: "https://cdn.rawgit.com/quantopian/qgrid/72d356cb123fab413dba73ec46616e4916fbd827/qgrid/qgridjs//qgrid.textfilter", filter_base: "https://cdn.rawgit.com/quantopian/qgrid/72d356cb123fab413dba73ec46616e4916fbd827/qgrid/qgridjs//qgrid.filterbase", handlebars: "https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.min" }; var existing_config = require.s.contexts._.config; if (!existing_config.paths['underscore']){ path_dictionary['underscore'] = "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min"; } if (!existing_config.paths['moment']){ path_dictionary['moment'] = "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.3/moment.min"; } if (!existing_config.paths['jqueryui']){ path_dictionary['jqueryui'] = "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min"; } require.config({ paths: path_dictionary }); if (typeof jQuery === 'function') { define('jquery', function() { return jQuery; }); } require([ 'jquery', 'jquery_drag', 'slick_core', 'slick_data_view' ], function(){('#b97d5b3e-85fe-4920-8635-2e5ddd467eff').closest('.rendered_html').removeClass('rendered_html'); require([ 'slick_check_box_column', 'slick_row_selection_model', 'slick_grid' ], function(){ require(["data_grid"], function(dgrid){ var grid = new dgrid.QGrid('#b97d5b3e-85fe-4920-8635-2e5ddd467eff',

pip install no longer works

Hi there,

since a few days (guess new release) I get this when doing my standard upgrade-check on the module (using latest anaconda 3.5 on latest mac osx).

| => pip install qgrid --upgrade --no-deps

Collecting qgrid
  Using cached qgrid-0.3.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/bs/gk3rhfzd2475g9vx5wlcqqb40000gn/T/pip-build-lq0rtygo/qgrid/setup.py", line 27, in <module>
        reqs = read_requirements('requirements.txt')
      File "/private/var/folders/bs/gk3rhfzd2475g9vx5wlcqqb40000gn/T/pip-build-lq0rtygo/qgrid/setup.py", line 24, in read_requirements
        with open(reqs_file) as f:
    FileNotFoundError: [Errno 2] No such file or directory: '/private/var/folders/bs/gk3rhfzd2475g9vx5wlcqqb40000gn/T/pip-build-lq0rtygo/qgrid/requirements.txt'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/bs/gk3rhfzd2475g9vx5wlcqqb40000gn/T/pip-build-lq0rtygo/qgrid

How does qgrid tell ipython notebook which js files to load?

Sorry, i'm pretty new to javascript. How does qgrid tell ipython notebook which js files to load?

The only place i could find any kind of "import" statement was in the slickgrid.js.template file:
var path_dictionary = {{
jquery_drag: "{cdn_base_url}/lib/jquery.event.drag-2.2",
slick_core: "{cdn_base_url}/lib/slick.core.2.2",
slick_data_view: "{cdn_base_url}/lib/slick.dataview.2.2",
slick_check_box_column: "{cdn_base_url}/lib/slick.checkboxselectcolumn",
slick_row_selection_model: "{cdn_base_url}/lib/slick.rowselectionmodel",
slick_grid: "{cdn_base_url}/lib/slick.grid.2.2",
data_grid: "{cdn_base_url}/qgrid",
data_grid_bb: "{cdn_base_url}/qgrid.bb",
date_filter: "{cdn_base_url}/qgrid.datefilter",
slider_filter: "{cdn_base_url}/qgrid.sliderfilter",
text_filter: "{cdn_base_url}/qgrid.textfilter",
filter_base: "{cdn_base_url}/qgrid.filterbase",
handlebars: "https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.min"
}};

however, if i add a js file to this path, it does not appear to load in the browser. Is there something else that needs to be modified for a JS file to load?

Installation instructions not working on Win7

I have GitHub for windows installed but the pip install instructions in the demo notebook didn't work for me (cannot find command 'git'). Could you help? Looks like a very cool project.

Tables selectively not rendering

Howdy,
I have a notebook where the following correctly displays a table:

df = pd.DataFrame([1,2,3,4])
qgrid.show_grid(df)

However, when I try to display a denser dataframe in the same notebook, the output shows, but is removed on page refresh, while the above continues to display correctly. Is there some sort of limit to how big the dataframe can be? Any other potential cause for this? I can't release the dataset that's causing this. Some ideas for possible causes would be great so I can make a reproducible case.

Edit: was able to repro the issue by repeatedly displaying a dataframe with of dimensions around 15x100. 3 times seems to do the trick to cause failure.
Seems like it was dataframe size related after all:

WrappedError {stack: "Error: Could not call widget save state callback.↵…in.js?v=40e10638fcf65fc1c057bff31d165e9d:12785:33", message: "Could not call widget save state callback.", error_stack: Array[2]}
error_stack: Array[2]
0: DOMException: Failed to set the 'widgets:http://192.168.1.113:8888/notebooks/qqgrid%20test.ipynb' property on 'Storage': Setting the value of 'widgets:http://192.168.1.113:8888/notebooks/qqgrid%20test.ipynb' exceeded the quota. at Error (native) at null.<anonymous> (http://192.168.1.113:8888/nbextensions/widgets/widgets/js/manager.js?v=20151223164406:523:27) at http://192.168.1.113:8888/nbextensions/widgets/widgets/js/manager.js?v=20151223164406:454:35
code: 22
message: "Failed to set the 'widgets:http://192.168.1.113:8888/notebooks/qqgrid%20test.ipynb' property on 'Storage': Setting the value of 'widgets:http://192.168.1.113:8888/notebooks/qqgrid%20test.ipynb' exceeded the quota."
name: "QuotaExceededError"
stack: "Error: Failed to set the 'widgets:http://192.168.1.113:8888/notebooks/qqgrid%20test.ipynb' property on 'Storage': Setting the value of 'widgets:http://192.168.1.113:8888/notebooks/qqgrid%20test.ipynb' exceeded the quota.↵    at Error (native)↵    at null.<anonymous> (http://192.168.1.113:8888/nbextensions/widgets/widgets/js/manager.js?v=20151223164406:523:27)↵    at http://192.168.1.113:8888/nbextensions/widgets/widgets/js/manager.js?v=20151223164406:454:35"

qgrid requires ipywidgets-4.1.1

I'm putting this here both as an issue for potential fixing, and a warning to others who might burn a whole day trying to debug this. qgrid will not work with version 5+ of ipywidgets. There has been significant code refactoring, and the relevant javascript that's used by qgrid is no longer where expected. I've spent a little time looking into what it would take to update qgrid to work with ipywidgets 5+, but am not familiar enough with the codebases to have a good feel for how difficult the task will be.

Adding and Removing Rows does not work

The following code seems to throw some javascript errors when I click on Add/Remove Rows:
Selection and Editing still seem to work fine.

This is using python 2.7, IPython 4.1.1 and master branch of qgrid.

import qgrid
import IPython
print IPython.__version__

import pandas
import numpy as np

res = pandas.DataFrame(np.arange(20).reshape(10,2))
res.index = np.arange(len(res))

qgrid.nbinstall(overwrite=True)
qgrid.show_grid(res, show_toolbar=True)

The exception I see in the chrome js console reads:

Exception in Comm callback Each data element must implement a unique 'id' property undefined Object {parent_header: Object, msg_type: "comm_msg", msg_id: "b14613d9-f5a9-4c99-bc7e-3d8516296885", content: Object, header: Object…}buffers: Array[0]channel: "iopub"content: Objectcomm_id: "83a82de5e21e4a588d83b7d054924db6"data: Objectcontent: Objectmethod: "custom"proto: Object__proto__: Objectheader: Objectmetadata: Object__proto__: Objectmsg_id: "b14613d9-f5a9-4c99-bc7e-3d8516296885"msg_type: "comm_msg"parent_header: Object__proto__: Object

Any thoughts?

qgrid does not appear

I am trying to load a qgrid from a pandas dataframe, but when I run:

import qgrid
import pandas as pd
df=pd.DataFrame([dict(idx=0,A=1),dict(idx=2,A=2)])`

Nothing happens (no error or anything else). Here are errors listed in my JS console:

Couldn't create a view for model id 'd7522ce5e25148848c5e49c7fdf8f795' -- TypeError: require is not a function(…)
(anonymous function) @ utils.js:760
z @ VM218:22R @ VM218:22
(anonymous function) @ VM218:22
g @ VM218:22

utils.js:760 Could not create view -- WrappedError {stack: "Error: Couldn't create a view for model id 'd7522c…39d168d24e1b201697c328:1:0), :22:8069)", message: "Couldn't create a view for model id 'd7522ce5e25148848c5e49c7fdf8f795'", error_stack: Array[3]}(anonymous function) @ utils.js:760
z @ VM218:22
R @ VM218:22
C @ VM218:22T @ VM218:22
g @ VM218:22

utils.js:760 Could not display model -- WrappedError {stack: "Error: Could not create view↵ at new Error (nat…39d168d24e1b201697c328:1:0), :22:8069)", message: "Could not create view", error_stack: Array[4]}(anonymous function) @ utils.js:760
z @ VM218:22
R @ VM218:22
C @ VM218:22T @ VM218:22
g @ VM218:22

Column Options

Just wondering if there will be support for slick grid's column options.

Add logic for automatic display in ipython

Using the IPython display architecture you can register functions that are automatically called when a DataFrame is displayed. This will enable users to optionally enable qgrid to display DataFrame by default, without an extra call. Running on a plane now, but please ping the ipython devs (or me later) on how this can be done. Awesome work!

DataGrid width not tied to browser window width

Fantastic project, my team's been meaning to create something like this for months now. Kudos!!

The DataFrames we're working with tend to have many columns (100+). Currently, when I render a qgrid it looks like this:

screen shot 2014-10-14 at 11 06 16 am

It would be great for us to have an option that does not limit the qgrid width to your browser, and instead overflows horizontally. You'd still see all columns, but you'd need to scroll (like in Excel).

Possible to copy data?

Hi,
thanks for this great extension!

I was wondering if copying data from qgrid table is possible, and if so how?

In Chrome, if I try to select some table cells it simple has no effect.
In Firefox, I'm able to select cells while dragging the mouse with left mouse button being pressed, but as soon as I release the left mouse button, selection disappears, and I'm not able to copy any data.

Objects don't display properly

Objects, including PeriodIndexs don't display properly. And some objects raise because they're not JSON serializable.

Calling str on these first would solve this

pd.DataFrame({'a': pd.Series(5, index=pd.period_range(start='2000', periods=10, freq='B'))}).pipe(qgrid.show_grid)

image

Upload new release to pypi

There's a critical patch in the master, namely that installation does not require superuser privileges. I think upgrading the qgrid that's avail on pypi would make installation much easier.

working on jupyter but not jupyterhub

I love the idea of sorting and filtering my dataframes in the notebooks directly. i tried to install qgrid on my local and on a remote system on jupyterhub. without success.

what i did
I did pip3 install qgrid and after importing qgrid I tried a qgrid.show_grid(df) right away. no success, no output.
so i additionally ran: qgrid.nbinstall(overwrite=True) i read about in the demo.

symptoms are

  • it can't access the css and js files: https://blabla.com/hub/nbextensions/qgridjs/lib/slick.grid.css Failed to load resource: the server responded with a status of 404 (Not Found) in the chrome console and I receive a 404 in the logfiles of jupyterhub for those files:
  • if i use jupyter notebook with jupyter notebook instead of jupyterhub on my local system it works and everything is loaded correctly
  • if i use jupyterhub and start show_grid with show_toolbar=True parameter and click on Export. qgrid is loaded all of a sudden and everything is loaded.

any idea where i can look into? thanks

update version on pypi

The version currently available on pypi force-downgrades several packages. It would be nice to update to the current version on pypi, which has fixed requirements.txt, so this doesn't happen anymore.

Add an IPython Widget?

I created a QGrid IPython Widget (valid for IPython 3.x). It adds the ability to edit the dataframe in-place, including adding and removing rows. It requires no changes to the existing codebase.

Are you interested in a PR that adds this widget?
I'm not sure what the best way to package it would be. Perhaps a qgrid.prepare_notebook() that loads qgrid_widget.js using IPython.display.Javascript. You could then expose qgrid.QGridWidget as well as qgrid.edit_dataframe(), that runs the application with the add/remove row buttons and returns the modified dataframe.

qgrid_widget

Qn: Filter non numeric columns?

Don't know if this is a limitation of SlickGrid or qgrid. Is it possible or are you planning to allow filtering of non-numeric content in columns?

Show (filtered) column totals

Is it possible that the (numeric) column filter selections make it possible to show updated column totals somewhere automatically?

Sort like Float, Display like String

I have a qgrid that contains $ amounts that I would like to have displayed with commas separators but if I change the value types from float to string, the columns do not sort properly. How can i get around this?

Better handling of defaults

Right now, defaults are handled outside the QGridWidget class. Thus, if you try to instantiate a QGridWidget it fails as it doesn't have the right default args. In general Widgets should manage their own defaults internally. It is not difficult to set this up using traitlets and we probably don't have to break any APIs.

No filter icon for Strings (`object`) columns in pandas dataframe

Hi,

In the example at nbviewer, there are also filter icons displayed for non-numeric columns, which does not happen on my local install.

Would you know why this is the case? May it be because the the qgrid.nbinstall() command gives the following error: PermissionError: [Errno 13] Permission denied: '/usr/local/share/jupyter'? It seems to work fine otherwise (and I am not sure why this nbinstall() needs to be run.

Thanks for any help!

Fix sizing of `QGridWidget`

Right now the QGridWidget sizes itself in wonky ways. It actually extends beyond that edge of the widget area. The main thing is to setup the sizing such that:

  • It works inside other widgets that use flexbox for layout.
  • It works at the top level and stays within the widget area.

ping @aggFTW

installation error

qgrid.nbinstall()  # copies javascript dependencies to your /nbextensions folder 
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-ca03556e1713> in <module>()
----> 1 qgrid.nbinstall()  # copies javascript dependencies to your /nbextensions folder

C:\Python\Python27\lib\site-packages\qgrid\__init__.pyc in nbinstall(user, overwrite)
     23         user=user,
     24         symlink=False,
---> 25         verbose=0,
     26     )

TypeError: install_nbextension() got an unexpected keyword argument 'user'

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.