Skip to content

Instantly share code, notes, and snippets.

@mattjj
Last active October 11, 2015 21:18
Show Gist options
  • Save mattjj/3920676 to your computer and use it in GitHub Desktop.
Save mattjj/3920676 to your computer and use it in GitHub Desktop.
simple dateplotter
#!/usr/bin/env python
from __future__ import division
import sys, dateutil
from matplotlib import pyplot as plt
def main(sep='\t'):
dates, vals = [], []
for line in sys.stdin:
try:
datestring, valstring = line.strip().split(sep)
print datestring
date = dateutil.parser.parse(datestring,fuzzy=True)
val = float(valstring)
except:
continue
dates.append(date)
vals.append(val)
plt.plot_date(dates,vals)
plt.show()
if __name__ == '__main__':
main(*sys.argv[1:])
@mattjj
Copy link
Author

mattjj commented Oct 23, 2012

theurl='http://www.federalreserve.gov/datadownload/Output.aspx?rel=H15&series=96daf78ac9574dadeda684107ee57f34&lastObs=&from=&to=&filetype=csv&label=include&layout=seriescolumn'

curl -s "$theurl" | tail -n 300 | sed 's/,/ /' | dateplotter.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment