forked from Te-k/analyst-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheatmap.py
More file actions
executable file
·22 lines (19 loc) · 776 Bytes
/
Copy pathheatmap.py
File metadata and controls
executable file
·22 lines (19 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python3
import numpy as np;
import pandas as pd
import calmap # Use my fork https://github.com/Te-k/calmap
import matplotlib.pyplot as plt
import argparse
# references
# https://pythonhosted.org/calmap/
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Create a heatmap based on csv file')
parser.add_argument('FILE', help='Csv file, like 2018-07-01;1 for 1 incident that day')
parser.add_argument('--sep', '-s', default=';',
help='Separator for the csv file (default is ;)')
args = parser.parse_args()
df=pd.read_csv(args.FILE, sep=args.sep,header=None)
dates = pd.to_datetime(df[0])
events = pd.Series(np.array(df[1]), index=dates)
calmap.yearplot(events, year=min(dates).year)
plt.show()