|
@ -0,0 +1,47 @@ |
|
|
|
|
|
# In[1]: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Importer les librairies |
|
|
|
|
|
import pandas as pd |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# In[2]: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Ouvrir un fichier CSV |
|
|
|
|
|
#Ajout d'un séparateur des colonnes |
|
|
|
|
|
df = pd.read_csv (r'/Users/marinegalanth/Desktop/inondation_bdd/bd_inondation/cedex.csv',sep = ';') |
|
|
|
|
|
print(df) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# In[3]: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Renommer les colonnes sélectionnées |
|
|
|
|
|
df = df.rename(columns={'Code INSEE': 'codepostal', 'Libellé': 'libelle', 'Code Postal / CEDEX': 'cedex'}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# In[4]: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
df=df[["codepostal","libelle","cedex"]] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# In[5]: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Créer un dataframe |
|
|
|
|
|
df1 = pd.DataFrame(df) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# In[6]: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
df1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# In[ ]: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|