Jupyter Widget

A Jupyter Widget wrapper for Python is located at lineup_widget.

Installation

  1. install Jupyter Widgets
    pip install ipywidgets
    jupyter nbextension enable --py widgetsnbextension
    
  2. install library
    pip install lineup_widget
    jupyter nbextension enable --py --sys-prefix lineup_widget
    
  3. OR directly via repository (requires node and npm to be installed):
    pip install -e git+https://github.com/lineupjs/lineup_widget.git#egg=lineup_widget
    jupyter nbextension enable --py --sys-prefix lineup_widget
    
  4. Jupyterlab
    jupyter labextension install @jupyter-widgets/jupyterlab-manager
    jupyter labextension install lineup_widget
    

Examples

![Launch Binder]https://camo.githubusercontent.com/70c5b4d050d4019f4f20b170d75679a9316ac5e5/687474703a2f2f6d7962696e6465722e6f72672f62616467652e737667

import lineup_widget
import pandas as pd
import numpy as np

df = pd.DataFrame(np.random.randint(0,100,size=(100, 4)), columns=list('ABCD'))

w = lineup_widget.LineUpWidget(df)
w.on_selection_changed(lambda selection: print(selection))
w

simple usage

from __future__ import print_function
from ipywidgets import interact, interactive, interact_manual

def selection_changed(selection):
    return df.iloc[selection]

interact(selection_changed, selection=lineup_widget.LineUpWidget(df));

interact example

Hint:

In case you see scrollbars in each cell it is because of the font the cells are too narrow, you can specify a larger row height using

w = lineup_widget.LineUpWidget(df, options=dict(rowHeight=20))