Last active
October 11, 2015 21:18
-
-
Save mattjj/3920676 to your computer and use it in GitHub Desktop.
simple dateplotter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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:]) | |
Author
mattjj
commented
Oct 23, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment