In [ ]:
import numpy as np
import pandas as pd

In [ ]:
from jupyter_scisheets_widget import example
hello_world = example.HelloWorld()
hello_world

In [ ]:
from jupyter_scisheets_widget import scisheets_widget
#hello_world = jupyter_scisheets_widget()
#hello_world

In [ ]:
scisheets_widget.SciSheetTable()

In [ ]:
scisheets_widget.HandsonDataFrame(df).show()

In [ ]:
hdf = HandsonDataFrame(df)

In [ ]:
hdf._df

In [ ]:
hdf.show()

In [ ]:
df

In [ ]:
from IPython.display import display

In [ ]:
class HandsonDataFrame(object):
    def __init__(self, df):
        self._df = df
        self._widget = scisheets_widget.SciSheetTable()
        self._widget._model_data = list(self._df.to_json(orient='values'))
        #self._widget.observe(self._on_data_changed, 'value')
        #self._widget.on_displayed(self._on_displayed)

    def _on_displayed(self, e): 
        # DataFrame ==> Widget (upon initialization only)
        json = self._df.to_json(orient='values')
        self._widget.value = json
    
    def _on_data_changed(self, e, val):
        # Widget ==> DataFrame (called every time the user
        # changes a value in the graphical widget)
        buf = StringIO.StringIO(val)
        self._df = pd.read_json(buf, orient='values')
        self._widget.unobserve(self._on_data_changed, 'value')
        
    def to_dataframe(self):
        return self._df
    
    def show(self):
        display(self._widget)

In [ ]:
display(hdf._widget)

In [ ]:
hdf = scisheets_widget.HandsonDataFrame(df)
hdf.show()

In [ ]:
display(hdf)

In [ ]:
data = np.random.randint(size=(3, 5), low=100, high=900)
df = pd.DataFrame(data)
df

In [ ]:


In [ ]:
data = np.random.randint(size=(3, 5), low=100, high=900)
df = pd.DataFrame(data)

In [ ]:
df = pd.DataFrame({'a':[1,3,5,7,4,5,6,4,7,8,9],
                   'b':[3,5,6,2,4,6,7,8,7,8,9]})

In [ ]:
df['a'].tolist()

In [ ]:
scisheets_widget.SciSheetTable().set_data(df['a'].tolist())

In [ ]:
table_ex = scisheets_widget.SciSheetTable()

In [ ]:
table_ex.set_data(df['a'].tolist())

In [ ]:
table_ex

Test to make sure widgets work in notebook


In [ ]:
import ipywidgets as widgets

In [ ]:
widgets.IntSlider()

In [ ]: