File size: 988 Bytes
efc3a78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# AUTOGENERATED! DO NOT EDIT! File to edit: ../update_classement.ipynb.

# %% auto 0
__all__ = ['PAGE', 'html_tables', 'df_adherents', 'get_classement', 'add_classements']

# %% ../update_classement.ipynb 2
PAGE = 'https://badmania.fr/club-joueurs-2254-riom-badminton-club.html'

# %% ../update_classement.ipynb 3
import pandas as pd
html_tables = pd.read_html(PAGE)
df_adherents = html_tables[0]


# %% ../update_classement.ipynb 7
def get_classement(
    license_number,# le numero de license
):
#    print(license_number)
    if len(df_adherents[df_adherents['Licence'] == license_number]['Class.'].values)>0:
        return df_adherents[df_adherents['Licence'] == license_number]['Class.'].values[0]
    else:
        return ''

# %% ../update_classement.ipynb 19
def add_classements(dataframe, #le dataframe des adherents
                   ):
    dataframe = dataframe.copy()
    dataframe['Classement']= dataframe['Licence'].apply(lambda x: get_classement(x))
    return dataframe