Skip to content

Instantly share code, notes, and snippets.

@icholy
Created December 4, 2014 22:12
Show Gist options
  • Save icholy/fef48ca51c39482e3c79 to your computer and use it in GitHub Desktop.
Save icholy/fef48ca51c39482e3c79 to your computer and use it in GitHub Desktop.
#!/usr/bin/env
from datetime import datetime
import matplotlib.pyplot as plt
def main():
lines = open("commits.txt").read().split("\n")
lines = [l.split(",") for l in lines]
lines = [l for l in lines if l[0].strip() != '']
records = [
[
int(l[0].strip()),
datetime.strptime(l[1].strip(), "%Y-%m-%d").date()
] for l in lines
]
def is_ok(d):
if d.year != 2014:
return False
if 10 < d.month < 13:
return True
return False
# filter
records = [r for r in records if is_ok(r[1])]
values = [r[0] for r in records]
dates = [r[1] for r in records]
fig = plt.figure()
ax = plt.subplot(111)
ax.bar(dates, values)
ax.xaxis_date()
fig.show()
plt.show()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment