我正在尝试在另一个“输出 View ”选项卡中显示我的 pandas 数据框,如此 iamge 中所示...
https://github.com/quantopian/qgrid/blob/master/docs/images/events_api.gif
我能够使用以下命令安装和试用 qgrid 的基本功能。但无法获得如上所示的确切 View 。
!pip install qgrid
!jupyter nbextension enable --py --sys-prefix qgrid
!jupyter nbextension enable --py --sys-prefix widgetsnbextension
import qgrid
import pandas as pd
df = pd.read_csv('some.csv')
qgrid_widget = qgrid.show_grid(df, show_toolbar=True)
qgrid_widget
qgrid_widget.get_changed_df()
请您参考如下方法:
这些命令应该有效:
预安装:
1. Assume you have conda environment called "myenv"
2. Assume you have jupyter-lab installed in that environment
安装新的Conda环境
source activate myenv
pip install qgrid
jupyter labextension install qgrid
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter nbextension enable --py --sys-prefix qgrid
jupyter nbextension enable --py --sys-prefix widgetsnbextension
加载conda环境
source activate myenv
jupyter-lab
create a notebook under environment myenv
-------------------- 这些只是安装前的程序--------
---------------- 以下是您在 jupyter lab 中使用 qgrid 的方法 ----------
# Lets say you have a pandas dataframe `df`
qgrid_widget = qgrid.show_grid(df.head(), show_toolbar=True)
qgrid_widget
qgrid_widget.get_changed_df()
# right click on this cell
# click Create New View for Output # it will create new tab
# You will see the new window of dataframe
