Debian Codegraph @

mtxclient/examples/plot_history.py

raw symbols SCIP
1 import pandas as pd
2
3 # Script to plot the file from memberstats
4
5 tsv_data = pd.read_csv('history.tsv', sep='\t')
6 tsv_data = tsv_data.sort_values(by=['timestamp'])
7 tsv_data["timestamp"] = pd.to_datetime(tsv_data["timestamp"], unit = 'ms')
8
9 count = 0
10 def inc():
11 global count
12 count += 1
13 return count
14 def dec():
15 global count
16 count -= 1
17 return count
18
19 tsv_data['count'] = tsv_data.apply((lambda x: inc() if x['joined'] == 'j' else dec()), axis=1)
20
21 print(tsv_data.head(20))
22 print(tsv_data.tail(20))
23
24 p = tsv_data.plot.line(x='timestamp', y='count')
25 p.get_figure().savefig('nheko_hist.png')
26