Skip to content

Commit 481f5b1

Browse files
committed
fix heatmaps
1 parent 01c1140 commit 481f5b1

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

heatmaps.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
import requests
21
import sys
2+
3+
import matplotlib.pyplot as plt
34
import pandas
45
import seaborn as sns
5-
import matplotlib.pyplot as plt
66

77
pandas.options.mode.chained_assignment = None
88

99
tournament: str = ""
1010
try:
11-
tournament: str = sys.argv[1].split("/")[-1]
11+
tournament = sys.argv[1].split("/")[-1]
1212
except IndexError:
1313
print("No tournament (e.g. 2019-06-01_nationals_c) provided!")
1414
exit(1)
15-
r = requests.get(f"https://duosmium.org/results/{tournament}")
16-
comp_yaml = requests.get(f"https://duosmium.org/data/{tournament}.yaml")
17-
p = pandas.read_html(r.text)
18-
table = p[0]
19-
table = table[table.columns[4:-1]]
20-
table.columns = [c.replace(" Td", "").replace(" T", "") for c in table.columns]
21-
corr = table.corr()
15+
16+
table = pandas.read_csv(f"https://duosmium.org/results/csv/{tournament}/")
17+
table = table[table.columns[8:]]
18+
corr = table.corr(numeric_only=True)
2219
plt.figure(figsize=(20, 20))
23-
sns.heatmap(data=corr, annot=True, cmap="YlGnBu").get_figure().savefig(f"{tournament}_corr.png")
20+
sns.heatmap(data=corr, annot=True, cmap="YlGnBu").get_figure().savefig(f"corr.png")

0 commit comments

Comments
 (0)