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

Binder demo does not work #310

Open
joncooper opened this issue Apr 22, 2020 · 2 comments
Open

Binder demo does not work #310

joncooper opened this issue Apr 22, 2020 · 2 comments

Comments

@joncooper
Copy link

joncooper commented Apr 22, 2020

Environment

Binder via Chrome on Windows

Description of Issue

  • What did you expect to happen?

Expected the demo Jupyter notebook to work via binder link from project homepage.

  • What happened instead?

See below for traceback.

Reproduction Steps

  1. Visit https://github.com/quantopian/qgrid
  2. Click "launch binder" button under "Click the badge below to try out qgrid using binder:"
  3. Wait for binder to launch Jupyter notebook
  4. Scroll down to "Example 1" cell and Shift-Enter to evaluate it
  5. Cell fails to evaluate with error:
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-ef1f68cba5a6> in <module>
     10     'D' : ["foo", "bar", "buzz", "bippity","boppity", "foo", "foo", "bar", "zoo"] })
     11 df_types['E'] = df_types['D'] == 'foo'
---> 12 qgrid_widget = qgrid.show_grid(df_types, show_toolbar=True)
     13 qgrid_widget

/srv/conda/envs/notebook/lib/python3.7/site-packages/qgrid/grid.py in show_grid(data_frame, show_toolbar, precision, grid_options, column_options, column_definitions, row_edit_callback)
    509                        column_definitions=column_definitions,
    510                        row_edit_callback=row_edit_callback,
--> 511                        show_toolbar=show_toolbar)
    512 
    513 

/srv/conda/envs/notebook/lib/python3.7/site-packages/qgrid/grid.py in __init__(self, *args, **kwargs)
    625 
    626         if self.df is not None:
--> 627             self._update_df()
    628 
    629     def _grid_options_default(self):

/srv/conda/envs/notebook/lib/python3.7/site-packages/qgrid/grid.py in _update_df(self)
    818         self._unfiltered_df = self._df.copy()
    819 
--> 820         self._update_table(update_columns=True, fire_data_change_event=False)
    821         self._ignore_df_changed = False
    822 

/srv/conda/envs/notebook/lib/python3.7/site-packages/qgrid/grid.py in _update_table(self, update_columns, triggered_by, scroll_to_row, fire_data_change_event)
    877                        isinstance(col_series, pd.PeriodIndex)
    878 
--> 879             if type(df.index) == pd.core.index.MultiIndex:
    880                 self._multi_index = True
    881                 for idx, cur_level in enumerate(df.index.levels):

AttributeError: module 'pandas.core' has no attribute 'index'

...

What steps have you taken to resolve this already?

None

Anything else?

The Jupyterlab flavor of the demo also fails

@0Hughman0
Copy link

0Hughman0 commented May 10, 2020

I just encountered this same problem after installing qgrid. Seems to be a compatibility issue, looks like MultiIndex has moved in Pandas - hence this error. Looking at qgrid/grid.py it seems like this problem is fixed in qgrid v1.3.0. For me PyCharm installed the older 1.1.1 version. I fixed the issue for myself by installing a new version from pip.

@StephieLaPugh
Copy link

I had the same problem and 0Hughman0's fix worked for me too.

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

No branches or pull requests

3 participants