|
|
@ -0,0 +1,54 @@ |
|
|
|
#!/usr/bin/env python |
|
|
|
# coding: utf-8 |
|
|
|
|
|
|
|
# In[1]: |
|
|
|
|
|
|
|
|
|
|
|
#importer la librairie Pandas |
|
|
|
import pandas as pd |
|
|
|
|
|
|
|
|
|
|
|
# In[2]: |
|
|
|
|
|
|
|
|
|
|
|
#ouvrir un fichier CSV les zones sismiques |
|
|
|
df = pd.read_csv (r'/Users/marinegalanth/Desktop/inondation_bdd/_zonage_sismique/France_zonage_sismique.csv') |
|
|
|
print(df) |
|
|
|
|
|
|
|
|
|
|
|
# In[3]: |
|
|
|
|
|
|
|
|
|
|
|
#Renommer les colonnes sélectionnées |
|
|
|
df = df.rename(columns={'insee,C,80 ': 'codepostal', ' nom,C,80': 'nomcommune', 'departemen,C,80': 'departement', 'Sismicite,C,80': 'sismicite'}) |
|
|
|
|
|
|
|
|
|
|
|
# In[8]: |
|
|
|
|
|
|
|
|
|
|
|
#créer un dataframe |
|
|
|
df=pd.DataFrame(df) |
|
|
|
|
|
|
|
|
|
|
|
# In[17]: |
|
|
|
|
|
|
|
|
|
|
|
#Remplacer l'échelle du zonage sismique de 1-4 |
|
|
|
df['sismicite'] = df['sismicite'].str.replace('1 - TrÞs faible','01TrFai') |
|
|
|
df['sismicite'] = df['sismicite'].str.replace('2 - Faible','02Fai') |
|
|
|
df['sismicite'] = df['sismicite'].str.replace('3 - ModÚrÚe','03Mod') |
|
|
|
df['sismicite'] = df['sismicite'].str.replace('4 - Moyenne','04Moy') |
|
|
|
|
|
|
|
|
|
|
|
# In[18]: |
|
|
|
|
|
|
|
|
|
|
|
#afficher le dataframe |
|
|
|
df |
|
|
|
|
|
|
|
|
|
|
|
# In[ ]: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|