You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
930 B
54 lines
930 B
#!/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[ ]:
|
|
|
|
|
|
|
|
|