Fetching contributors…
Cannot retrieve contributors at this time
11 lines (10 sloc) 712 Bytes
# View time-series data as a line chart in Canvas
# This renders a similar chart to
import calendar
import graphlab as gl
import numpy # Requires 'pip install numpy==1.9.1'
sf = gl.SFrame.read_csv('')
date_as_int = [long(calendar.timegm(d.utctimetuple())) for d in sf['Date'].str_to_datetime()]
bin_edges = numpy.histogram(date_as_int, 499)
sf['bin'] = numpy.digitize(date_as_int, bin_edges[1], True)
sf.groupby('bin', gl.aggregate.AVG('Adj Close')).show(view='Line Chart', x='bin', y='Avg of Adj Close')