Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pylab import *
- import re, datetime
- fig = figure()
- fig.subplots_adjust(bottom=0.2)
- day_zero = datetime.date(2000, 1, 1)
- data_lines = open('out_comments_time.txt').read().splitlines() + open('out_posting_time.txt').read().splitlines()
- data = []
- for l in data_lines:
- l = l.strip()
- if not l:
- continue
- m = re.match('(xxxx)-(xx)-(xx) (xx):(xx):(xx)'.replace('x', '\\d'), l)
- assert m, repr(l)
- g = lambda i: int(m.group(i))
- if g(1) < 1500:
- continue
- dt = (datetime.date(g(1), g(2), g(3)) - day_zero)
- data.append((
- (dt.seconds + dt.days * 24 * 3600) / (365.25 * 24 * 60 * 60),
- (60*60*g(4) + 60*g(5) + g(6)) / 3600.0
- ))
- data.sort()
- print min(data), max(data)
- grid()
- plot([a[0] for a in data], [a[1] for a in data],'bo', alpha=0.3)
- show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement