Pandas 1.0.0 Compatibility
joshkreud opened this issue ยท 18 comments
Issue
Environment
- Operating System: WIN10 1903
- Python Version: 3.7.6
- How did you install Qgrid:
conda create -n qgrid_test python=3.7 qgrid pandas
Python packages in conda env:
(qgrid_test) H:\>conda list
# Name Version Build Channel
attrs 19.3.0 py_0 conda-forge
backcall 0.1.0 py_0 conda-forge
bleach 3.1.0 py_0 conda-forge
ca-certificates 2019.11.28 hecc5488_0 conda-forge
certifi 2019.11.28 py37_0 conda-forge
colorama 0.4.3 py_0 conda-forge
decorator 4.4.1 py_0 conda-forge
defusedxml 0.6.0 py_0 conda-forge
entrypoints 0.3 py37_1000 conda-forge
importlib_metadata 1.5.0 py37_0 conda-forge
inflect 4.0.0 py37_1 conda-forge
intel-openmp 2019.4 245
ipykernel 5.1.4 py37h5ca1d4c_0 conda-forge
ipython 7.11.1 py37h5ca1d4c_0 conda-forge
ipython_genutils 0.2.0 py_1 conda-forge
ipywidgets 7.5.1 py_0 conda-forge
jaraco.itertools 5.0.0 py_0 conda-forge
jedi 0.16.0 py37_0 conda-forge
jinja2 2.11.1 py_0 conda-forge
jsonschema 3.2.0 py37_0 conda-forge
jupyter_client 5.3.4 py37_1 conda-forge
jupyter_core 4.6.1 py37_0 conda-forge
libblas 3.8.0 14_mkl conda-forge
libcblas 3.8.0 14_mkl conda-forge
liblapack 3.8.0 14_mkl conda-forge
libsodium 1.0.17 h2fa13f4_0 conda-forge
m2w64-gcc-libgfortran 5.3.0 6
m2w64-gcc-libs 5.3.0 7
m2w64-gcc-libs-core 5.3.0 7
m2w64-gmp 6.1.0 2
m2w64-libwinpthread-git 5.0.0.4634.697f757 2
markupsafe 1.1.1 py37hfa6e2cd_0 conda-forge
mistune 0.8.4 py37hfa6e2cd_1000 conda-forge
mkl 2019.4 245
more-itertools 8.2.0 py_0 conda-forge
msys2-conda-epoch 20160418 1
nbconvert 5.6.1 py37_0 conda-forge
nbformat 5.0.4 py_0 conda-forge
notebook 6.0.3 py37_0 conda-forge
numpy 1.17.5 py37hc71023c_0 conda-forge
openssl 1.1.1d hfa6e2cd_0 conda-forge
pandas 1.0.0 py37he350917_0 conda-forge
pandoc 2.9.1.1 0 conda-forge
pandocfilters 1.4.2 py_1 conda-forge
parso 0.6.0 py_0 conda-forge
pickleshare 0.7.5 py37_1000 conda-forge
pip 20.0.2 py37_1 conda-forge
prometheus_client 0.7.1 py_0 conda-forge
prompt_toolkit 3.0.3 py_0 conda-forge
pygments 2.5.2 py_0 conda-forge
pyrsistent 0.14.11 py37hfa6e2cd_1 conda-forge
python 3.7.6 h5b45d93_2 conda-forge
python-dateutil 2.8.1 py_0 conda-forge
pytz 2019.3 py_0 conda-forge
pywin32 225 py37hfa6e2cd_0 conda-forge
pywinpty 0.5.7 py37_0 conda-forge
pyzmq 18.1.1 py37h16f9016_0 conda-forge
qgrid 1.1.1 py37_1001 conda-forge
send2trash 1.5.0 py_0 conda-forge
setuptools 45.1.0 py37_0 conda-forge
six 1.14.0 py37_0 conda-forge
sqlite 3.30.1 hfa6e2cd_0 conda-forge
terminado 0.8.3 py37_0 conda-forge
testpath 0.4.4 py_0 conda-forge
tornado 6.0.3 py37hfa6e2cd_0 conda-forge
traitlets 4.3.3 py37_0 conda-forge
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_1
wcwidth 0.1.8 py_0 conda-forge
webencodings 0.5.1 py_1 conda-forge
wheel 0.34.2 py37_0 conda-forge
widgetsnbextension 3.5.1 py37_0 conda-forge
wincertstore 0.2 py37_1003 conda-forge
winpty 0.4.3 4 conda-forge
zeromq 4.3.2 h6538335_2 conda-forge
zipp 2.1.0 py_0 conda-forge
Jupyterlab extensions:
Runs in base
environment accesses the environment kernel using nb_conda_kernels
(base) H:\>labextension list
JupyterLab v1.2.6
Known labextensions:
app dir: C:\ProgramData\Miniconda3\share\jupyter\lab
@aquirdturtle/collapsible_headings v0.5.0 enabled ok
@bokeh/jupyter_bokeh v1.1.1 enabled ok
@jupyter-widgets/jupyterlab-manager v1.1.0 enabled ok
@jupyterlab/toc v1.0.1 enabled ok
@lckr/jupyterlab_variableinspector v0.3.0 enabled ok
@pyviz/jupyterlab_pyviz v0.8.0 enabled ok
jupyter-matplotlib v0.5.0 enabled ok
jupyterlab-jupytext v1.1.1 enabled ok
jupyterlab-system-monitor v0.4.1 enabled ok
jupyterlab-theme-toggle v0.4.2 enabled ok
jupyterlab-topbar-extension v0.4.0 enabled ok
qgrid v1.1.1 enabled ok
Description of Issue
Qgrid seems to be incompatible with Pandas 1.0.0.
Reproduction Steps
Notebook Cell:
import qgrid
qwid = qgrid.show_grid(pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]}), show_toolbar=True)
qwid
Output:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-26-f756e5d59b94> in <module>
1 import qgrid
----> 2 qwid = qgrid.show_grid(pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]}), show_toolbar=True)
3 qwid
~\.conda\envs\WeldCompare\lib\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
~\.conda\envs\WeldCompare\lib\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):
~\.conda\envs\WeldCompare\lib\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
~\.conda\envs\WeldCompare\lib\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'
Possible solution
From Pandas Release Notes:
pandas.core.index has been deprecated and will be removed in a future version, the public classes are available in the top-level namespace (GH19711)
+1 same issue
I was able to get things working by modifying grid.py:
- line 879:
if type(df.index) == pd.core.index.MultiIndex:
->if type(df.index) == pd.MultiIndex:
- line 916:
if type(df.index) == pd.core.index.MultiIndex and \
->if type(df.index) == pd.MultiIndex and \
Just got hit by this issue too, so is the solution to downgrade for now, and then use the release the qgrid that has the update merged above?
The code edits above worked for me. I am so grateful, since I want to work with the latest pandas and Python 3.7 and not go backward. Can someone please push the edits to the Quantopian Qgrid repository?
I pushed the edits to the Quantopian github repo for this. I need someone to approve it to become part of the master.
Fixed in #290. Plans for a release? :)
i have the same error, fixing it please!
Does anyone know when will be the fixed version released so it can be installed through pip?
I had to downgrade. I hope the fix will release soon.
Hey all - thanks for all the reports/follow ups here! I'm currently working on a new CI/CD branch (#293) that uncovered some issues with pandas 1.0.1/qgrid. Namely:
- Some tz-naive and tz-aware timestamp issues
- Period columns not being able to be converted into json (pandas-dev/pandas#31917)
Once we fix or work around these issues, we'll cut a new release.
We've now released a new version. Period columns are still broken, but otherwise it is good to use with pandas 1.0
We've now released a new version. Period columns are still broken, but otherwise it is good to use with pandas 1.0
I just tried to install version 1.3.0 of qgrid via conda, but the most recent version in conda-forge seems to be 1.1.1. Is there another way to get 1.3.0 into Jupyter Lab?
@andreassimon I managed to bypass this by installing pip within the conda environment and just upgrading qgrid with pip install qgrid --upgrade
. I also had to remove the virualenv requirement of pip with export PIP_REQUIRE_VIRTUALENV=false
. Hope this helps!
I am a beginner, can someone tell me how to make this edit in the local
The problem is still there in June
I confirm this is still present in v.1.3.1 (Manjaro Linux, Pandas 1.0.3, no virtualenv)
Contra preceding two comments, I had this issue in 1.1.1 but did find it fixed after upgrading to 1.3.1. The issue may be that "stable" anaconda still provides qgrid 1.1.1; you need conda-forge enabled to get 1.3.1.
To fix in Navigator:
- From
Environments
tab, clickChannels
button - Enter channel name
conda-forge
and hit return - Hit
Update channels
button - You should now be able to search for qgrid 1.3.1 in the package list, add, and apply
To fix from command line:
- Use the config command given in the README to add the conda-forge channel
conda install qgrid
- Optionally, if you don't want your other packages upgraded to "bleeding edge" from conda-forge, you can remove conda-forge after qgrid-1.3.1 is installed:
conda config --remove channels conda-forge