qgrid
qgrid copied to clipboard
Binder demo does not work
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
- Visit https://github.com/quantopian/qgrid
- Click "launch binder" button under "Click the badge below to try out qgrid using binder:"
- Wait for binder to launch Jupyter notebook
- Scroll down to "Example 1" cell and Shift-Enter to evaluate it
- 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
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.
I had the same problem and 0Hughman0's fix worked for me too.