- autcomplete works on variable and function names
- Up arrow takes you back to previously entered commands
%quickrefgives an overview of available functionality.
iPython has "magic" commands which are an set of meta functions for
| import pandas as pd | |
| p = pd.read_csv('m:/presents.csv') | |
| p[:10] | |
| plt.plot(p[:10]) | |
| p.columns= 'id x y z'.split() | |
| p['volume'] = p.x * p.y * p.z |
| import numpy as np | |
| import pylab as lab | |
| # don't show all decimal places when printing | |
| np.set_printoptions(precision=4) | |
| # define a, b and c | |
| a = np.ones([4,4]) | |
| print "a:\n", a | |
| from bisect import bisect_left, bisect_right | |
| class TimeseriesCache(object): | |
| """Store a timeseries of data in memory for random access.""" | |
| def __init__(self, ttl=None): | |
| self.timestamps = [] | |
| self.data = [] | |
| self.ttl = ttl | |
| def add(self, timestamp, data): |
| include Java | |
| require 'blpapi3.jar' | |
| opts = com.bloomberglp.blpapi.SessionOptions.new | |
| opts.server_host = 'localhost' | |
| opts.server_port = 8194 | |
| session = com.bloomberglp.blpapi.Session.new opts | |
| service = '//blp/refdata' | |
| throw "Can't start Bloomberg" unless session.start && session.open_service(service) |