Demonstration of Use Case

  • Users can enter step by step explanations of changes made to a SciSheet in a Jupyter notebook

Load necessary packages


In [1]:
import json

import numpy as np
import pandas as pd

from jupyter_scisheets_widget import scisheets_widget

Load data into the notebook


In [ ]:
import pandas_datareader as pdr
ibm_data = pdr.get_data_yahoo('IBM')

In [2]:
income_data = pd.read_csv('income_data.csv', sep=';')
income_data


Out[2]:
GEOID State 2005 2006 2007 2008 2009 2010 2011 2012 2013
0 04000US01 Alabama 37150 37952 42212 44476 39980 40933 42590 43464 41381
1 04000US02 Alaska 55891 56418 62993 63989 61604 57848 57431 63648 61137
2 04000US04 Arizona 45245 46657 47215 46914 45739 46896 48621 47044 50602
3 04000US05 Arkansas 36658 37057 40795 39586 36538 38587 41302 39018 39919
4 04000US06 California 51755 55319 55734 57014 56134 54283 53367 57020 57528

Display the loaded data as a scisheet widget


In [4]:
tbl2 = scisheets_widget.HandsonDataFrame(income_data)
tbl2.show()



In [8]:
tbl2._df


Out[8]:
GEOID State 2005 2006 2007 2008 2009 2010 2011 2012 2013
0 04000US01 Alabama 37150 37952 42212 44476 39980 40933 42590 43464 41381
1 04000US02 Alaska 55891 56418 62993 63989 61604 57848 57431 63648 61137
2 04000US04 Arizona 45245 46657 47215 46914 45739 46896 48621 47044 50602
3 04000US05 Arkansas 36658 37057 40795 39586 36538 38587 41302 39018 39919
4 04000US06 California 51755 55319 55734 57014 56134 54283 53367 57020 57528

In [10]:
tbl2._widget._model_data


Out[10]:
u'[["04000US01", "Alabama", 37150, 37952, 42212, 44476, 39980, 40933, 42590, 43464, 41381], ["04000US02", "Alaska", 55891, 56418, 62993, 63989, 61604, 57848, 57431, 63648, 61137], ["04000US04", "Arizona", 45245, 46657, 47215, 46914, 45739, 46896, 48621, 47044, 50602], ["04000US05", "Arkansas", 36658, 37057, 40795, 39586, 36538, 38587, 41302, 39018, 39919], ["04000US06", "California", 51755, 55319, 55734, 57014, 56134, 54283, 53367, 57020, 57528]]'

In [9]:
tbl2._widget._model_header


Out[9]:
u'["GEOID", "State", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013"]'

In [ ]:


In [ ]:

Sanity check to explore df functionality


In [ ]:
def bob(df):
    df_bob = df
    df_bob['help'] = df_bob['State']
    
    return df_bob

In [ ]:
bob(income_data)

In [ ]:
bob2 = income_data

In [ ]:
income_data.update(bob2)

In [ ]:
income_data2 = income_data.copy()

In [ ]:
income_data2.loc[1, '2006'] = 'Tewnty'

In [ ]:
income_data2

In [ ]:
income_data

In [ ]:
income_data.update(income_data2)

In [ ]:
income_data

In [ ]: