summaryrefslogtreecommitdiff
path: root/get_table.py
blob: 2e8e3adfb0cca735eab5f4ab68729d97e939472d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import pandas as pd
import sys

try:
    assert len(sys.argv) == 3
except AssertionError:
    print("Give a url and name argument.")

try:
    all_tables = pd.read_html(
            sys.argv[1]
    )
    assert all_tables is not None or all_tables != []
    all_tables[0].to_csv('./csv/{}.csv'.format(sys.argv[2]))
except Exception as e:
    print("Something went wrong getting the table from the url")