<jupyter_start><jupyter_text>j'importe le dataframe final du bodacc<jupyter_code>import pandas as pd
from datetime import datetime, timedelta 
from keplergl import KeplerGl
df = pd.read_csv('data.csv')
df<jupyter_output><empty_output><jupyter_text>je rajoute les heures et les minutes<jupyter_code># rajouter les heures et les minutes
test = ' 0.00'
df['date_publication'] = df['date_publication'] + test
df<jupyter_output><empty_output><jupyter_text>je recupere le dataframe avec lat et long<jupyter_code>df2 = pd.read_csv('bodacc_p.csv', sep=";")
df2
df2=df2[['Code du Département','geo_point_2d']]

lat=[]
long=[]
for e in df2['geo_point_2d']:
    e=e.split(',')
    lat.append(float(e[0]))
    long.append(float(e[1]))

df2['lat']=lat
df2['long']=long


df2['lat'].round(6)
df2['long'].round(6)

df2 = df2.drop('geo_point_2d',axis=1)
df2 = df2.drop_duplicates()
#df2<jupyter_output><empty_output><jupyter_text>j'attribue le meme nom de colonne "departement" aux 2 dataframes<jupyter_code>df3 = df2.rename(columns={"Code du Département": "departement"})
df3<jupyter_output><empty_output><jupyter_text>je join les 2 dataframe avec la key 'departement' en commun<jupyter_code>df4 = df.join(df3.set_index('departement'), on='departement')
df4<jupyter_output><empty_output><jupyter_text>je suprime le 2 eme index inutile<jupyter_code>df5 = df4.drop('Unnamed: 0', axis=1)
df5<jupyter_output><empty_output><jupyter_text>j'affiche mes données sur une carte kepler  je rajoute une colonne qui compte le nombre de d'activités<jupyter_code>#df6 = df5.groupby(['lat','long']).size()
#df6
df5['counts'] = df5['departement'].map(df5['departement'].value_counts())
df5
map_3 = KeplerGl(height=500)
map_3.add_data(data=df5, name='data')
map_3
df5.groupby(by=["departement"], dropna=False).count()

#df4 = df5.groupby(['departement','lat','long'])['siren'].count()
#df4 = pd.DataFrame(df4)
#df4.reset_index(inplace=True)
#df4
df4.columns
map_4 = KeplerGl(height=500)
map_4.add_data(data=df4, name='data')
map_4<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15786877158362111, 'fraction_numerical': 0.033547113961519485, 'mean_word_length': 8.52112676056338, 'pattern_counts': {'":': 1, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '459864', 'license': 'MIT', 'n_tokens_mistral': 856, 'n_tokens_neox': 843, 'n_words': 147, 'path': '.ipynb_checkpoints/Mapping_kepler_Bodacc_VF-checkpoint.ipynb', 'repo_name': 'ThVal/Bodacc', 'size': '2027'}