Code Search for Developers
 
 
  

recarray_demo_skel.py from matplotlib at Krugle


Show recarray_demo_skel.py syntax highlighted

"""
parse and load ge.csv into a record array
"""
import time, datetime, csv
import dateutil.parser
import numpy

XXX = None
# create a csv reader to parse the file
fh = file('data/ge.csv')
reader = csv.reader(fh)
header = reader.next()

# iterate over the remaining rows and convert the data to date
# objects, ints, or floats as approriate
rows = []
for date, open, high, low, close, volume, adjclose in reader:
    XXX # conver the strings here
    rows.append((date, open, high, low, close, volume, adjclose))

fh.close()

# this is how you can use the function matplotlib.mlab.load to do the same
#rows = load('data/ge.csv', skiprows=1, converters={0:datestr2num}, delimiter=',')

r = numpy.rec.fromrecords(rows, names='date,open,high,low,close,volume,adjclose')

# compute the average approximate dollars traded over the last 10 days
# hint: closing price * volume trades approx equals dollars trades
XXX

# plot the adjusted closing price vs time since 2003 - hint, you must
# use date2num to convert the date to a float for mpl.  Make two axes,
# one for price and one for volume.  Use a bar chart for volume
import matplotlib
matplotlib.rcParams['usetex'] = False

XXX




See more files for this project here

matplotlib

Matplotlib is a pure python plotting library with the goal of making\r\npublication quality plots using a syntax familiar to matlab users. \r\nThe library uses Numeric for handling large\r\ndata sets and supports a variety of output backends

Project homepage: http://sourceforge.net/projects/matplotlib
Programming language(s): C,C++,Python
License: other

  faces/
    faces_skel0.tgz
    fmatch_skel1.py
  fortran_wrap/
    Makefile
    fib3.f
    test.py
  distributions_skel.py
  erathostenes_skel.py
  fft_imdenoise_skel.py
  fit_synapse_skel.py
  fitting_skel.py
  montecarlo_pi_skel.py
  polyroots1d_skel.py
  qsort_skel.py
  quad_newton_skel.py
  recarray_demo_skel.py
  regress_demo_skel.py
  scrape_key_stats_skel.py
  shoot_skel.py
  spline_demo_skel.py
  stats_descriptives_skel.py
  stats_distributions_skel.py
  trapezoid_skel.py
  wallis_pi_skel.py
  wordfreqs_skel.py