Skip to content

Instantly share code, notes, and snippets.

@riceissa
Last active February 6, 2018 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save riceissa/4506fa16d4dbae794387979843e74c22 to your computer and use it in GitHub Desktop.
Save riceissa/4506fa16d4dbae794387979843e74c22 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import sys
import pandas as pd
import matplotlib.pyplot as plt
calls = 0
data = []
with open(sys.argv[1], "r") as f:
for line in f:
if not line.strip():
continue
calls += 1
try:
time, donee = line.strip().split("\\t")
data.append((time, calls, donee))
except ValueError:
pass
df = pd.DataFrame(data, columns=['time', 'calls', 'donee'])
df['time'] = pd.to_datetime(df['time'])
df = df.set_index('time')
df.calls.plot(linestyle='none', marker='.', rot=45)
plt.ylabel("cumulative number of donees")
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment