<jupyter_start><jupyter_text>Liste de locaux et communesDonnées tirées du [site de l'Etat de Genève](https://www.ge.ch/votations/20180304/federal/)<jupyter_code># import libraries
import pandas as pd
# import files
df_raw = pd.read_csv('./DATA_format_JSON/listeLocaux.csv', delimiter=';')
df_raw.head()
# create new df and drop unnecessary columns
df_edt = df_raw.drop(['electorat', 'cartes-de-vote', 'bulletins','nuls','q1_blancs','q1_blancs_pc'
                      ,'q1_valables','q1_oui','q1_oui_pc','q1_non','q1_non_pc','q1_participation'
                      ,'q2_blancs','q2_blancs_pc','q2_valables','q2_oui','q2_oui_pc','q2_non','q2_non_pc'
                      ,'q2_participation'], axis=1)
df_edt.reset_index(drop=True, inplace=True)
df_edt.head(30)
# remove accents and spec chars from local-commune_nom
# remove accents from local-commune_nom
df_edt['local-commune_nom'] = df_edt['local-commune_nom'].str.lower()
df_edt['local-commune_nom'].replace(regex=True,inplace=True,to_replace='à',value='a')
df_edt['local-commune_nom'].replace(regex=True,inplace=True,to_replace='â',value='a')
df_edt['local-commune_nom'].replace(regex=True,inplace=True,to_replace='ä',value='a')
df_edt['local-commune_nom'].replace(regex=True,inplace=True,to_replace='é',value='e')
df_edt['local-commune_nom'].replace(regex=True,inplace=True,to_replace='è',value='e')
df_edt['local-commune_nom'].replace(regex=True,inplace=True,to_replace='ê',value='e')
df_edt['local-commune_nom'].replace(regex=True,inplace=True,to_replace='ï',value='i')
df_edt['local-commune_nom'].replace(regex=True,inplace=True,to_replace='ö',value='o')
df_edt['local-commune_nom'].replace(regex=True,inplace=True,to_replace='ô',value='o')
df_edt['local-commune_nom'].replace(regex=True,inplace=True,to_replace='ù',value='u')
df_edt['local-commune_nom'].replace(regex=True,inplace=True,to_replace='ü',value='u')
# remove spec chars from local-commune_nom
df_edt['local-commune_nom'].replace(regex=True,inplace=True,to_replace=" - ",value=' ')
df_edt['local-commune_nom'].replace(regex=True,inplace=True,to_replace="-",value=' ')
#df_edt['local-commune_nom'].replace(regex=True,inplace=True,to_replace="'",value='_')
#df_edt['local-commune_nom'].replace(regex=True,inplace=True,to_replace="   ",value=' ')
#df_edt['local-commune_nom'].replace(regex=True,inplace=True,to_replace=" ",value='_')
df_edt.head()
# create padded columns
df_edt['commune_no_padded'] = df_edt['commune_no'].astype(str).str.zfill(2)
df_edt['local_no_padded'] = df_edt['local_no'].astype(str).str.zfill(2)
# drop commune_no and local_no
df_edt.drop(['commune_no', 'local_no'], axis=1, inplace=True)
df_edt.head(30)
type(df_edt['commune_no_padded'])
# concatenate padded columns and drop them
df_edt['commLocal'] = df_edt['commune_no_padded'] + df_edt['local_no_padded']
# drop commune_no_padded and local_no_padded
df_edt.drop(['commune_no_padded', 'local_no_padded'], axis=1, inplace=True)
df_edt.head(30)
# export to csv
#df_local.to_csv('./electionBot_sBox/locals-Entities.csv',index=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18351324828263002, 'fraction_numerical': 0.01144913313706248, 'mean_word_length': 9.72982456140351, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '525265', 'license': 'MIT', 'n_tokens_mistral': 1233, 'n_tokens_neox': 1213, 'n_words': 119, 'path': '.ipynb_checkpoints/commune_local_no_concat_for_REST-checkpoint.ipynb', 'repo_name': 'Zabamund/chatbotGE', 'size': '3057'}