from smuggle import Smuggler, Payload # Reduce development costs and downtime!
# Create a safe place to smuggle objects to...
MySmuggler = Smuggler("C:\MyObjectLogFolder")
# Create some picklable objects...
aList = [1,2,3]
aDict = {'a' : 1, 'b' : 2, 'c' : 3}
# Use this in inconvenient code paths to augment logging and errors...
MySmuggler.smuggle(MyList=aList,MyDict=aDict,NoteToSelf="This is cool")
# Send this to an e-mail, log, or the screen.
print(MySmuggler.passphrases())
# There are a few systematic ways to access the pickled objects
MyPayload = Payload("C:\MyObjectLogFolder")
MyPayload.astimevardict2D()
from sympa import domath
#We need some other stuff to show off sympa
from sympy import *
from sympy.interactive.printing import init_printing
init_printing()
import pandas as pd
#Set up some data (ints, floats, and irrational!)
df = pd.DataFrame({'x' : range(7)})
df['x'] = df.x * 10
df['y'] = df.x * 0.05
df['r'] = pi * df['y'] / 2
df
x,y,r,rn1,x1,xn1,yn1 = symbols('x y r r_-1 x_1 x_-1 y_-1')
f = x + xn1
g = x**y + x*y*3.0 + (x1 * 0.5 + xn1 * pi / (yn1 + 1.0))**2
h = sin(r)
i = sin(r) / cos(rn1 + 1)
f, g, h, i
# This is where the magic happens...
# ...the symbol names link to column names, and the subscripts handle shifts properly.
df['f'] = domath(df,f)
df['g'] = domath(df,g)
df['h'] = domath(df,h)
df['i'] = domath(df,i)
df # Look mom, no lambda!
from rrsm import StateMachine
This isn't exactly for iPython Notebook. It's more for prototyping classes in a way that makes it harder to write undocumented code. Just by using this class, you have no choice but to document the states properly.
#Instantiation works with a list of the form ['state', ...]
#or a dictionary of the form {'state' : value, ...}
SM = StateMachine(['cool', 'off', 'on', 'warm']) #Initializes to the first state, "cool".
#checking state works against strings or integers:
SM == 'cool'
#Change the state
SM('warm')
#using attributes to check state:
SM == SM.cool
SM.current_state, SM.current_code
from IPython.lib.display import VimeoVideo
VimeoVideo(121615286,1056,594)