Created
December 29, 2019 15:57
-
-
Save Assios/f7cc9b68c140d37f265b3eb0739477b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import math | |
from tabulate import tabulate | |
import requests | |
ROUND_NUMBER = 8 | |
url = "http://chess-results.com/tnr499129.aspx?lan=1&zeilen=0&art=1&rd=%s&flag=30&prt=4" % ROUND_NUMBER | |
df = pd.read_excel(url, skiprows=[0, 1, 2, 3]) | |
rows = [] | |
for index, row in df.iterrows(): | |
rank = float(row["Rk."]) | |
if math.isnan(rank): | |
break | |
rows.append([row["Rk."], row["FED"], row["Unnamed: 3"], row["Name"], row[7]]) | |
with open("round_%s.md" % ROUND_NUMBER, "w") as f: | |
f.write(tabulate(rows, headers=["Ranking","FED", "Title", "Name", "Points"])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment