diff --git a/cedex_v1.py/cedex_v1.ipynb b/cedex_v1.py/cedex_v1.ipynb deleted file mode 100644 index 323354f..0000000 --- a/cedex_v1.py/cedex_v1.ipynb +++ /dev/null @@ -1,279 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "218a3acb", - "metadata": {}, - "outputs": [], - "source": [ - "#Importer les librairies \n", - "import pandas as pd" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "c27a317c", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " Code Postal / CEDEX Libellé Code INSEE Type de code \\\n", - "0 73350 CHAMPAGNY EN VANOISE 73071 Code Postal \n", - "1 67530 OTTROTT 67368 Code Postal \n", - "2 35190 ST DOMINEUC 35265 Code Postal \n", - "3 39120 PESEUX 39412 Code Postal \n", - "4 39200 LA RIXOUSE 39460 Code Postal \n", - "... ... ... ... ... \n", - "50598 97479 ST DENIS CEDEX 97411 Code CEDEX \n", - "50599 97489 ST DENIS CEDEX 97411 Code CEDEX \n", - "50600 97707 ST DENIS CEDEX 9 97411 Code CEDEX \n", - "50601 97717 ST DENIS CEDEX 9 97411 Code CEDEX \n", - "50602 97751 ST PIERRE CEDEX 97416 Code CEDEX \n", - "\n", - " Nom de la commune Nom du département \\\n", - "0 Champagny-en-Vanoise SAVOIE \n", - "1 Ottrott BAS-RHIN \n", - "2 Saint-Domineuc ILLE-ET-VILAINE \n", - "3 Peseux JURA \n", - "4 La Rixouse JURA \n", - "... ... ... \n", - "50598 Saint-Denis LA REUNION \n", - "50599 Saint-Denis LA REUNION \n", - "50600 Saint-Denis LA REUNION \n", - "50601 Saint-Denis LA REUNION \n", - "50602 Saint-Pierre LA REUNION \n", - "\n", - " NOM EPCI \\\n", - "0 CC Val Vanoise \n", - "1 CC des Portes de Rosheim \n", - "2 CC Bretagne Romantique \n", - "3 CA du Grand Dole \n", - "4 CC Haut-Jura Saint-Claude \n", - "... ... \n", - "50598 CA Intercommunale du Nord de la Réunion (Cinor) \n", - "50599 CA Intercommunale du Nord de la Réunion (Cinor) \n", - "50600 CA Intercommunale du Nord de la Réunion (Cinor) \n", - "50601 CA Intercommunale du Nord de la Réunion (Cinor) \n", - "50602 CA Civis (Communauté Intercommunale des Villes... \n", - "\n", - " Nom de la région \n", - "0 AUVERGNE-RHONE-ALPES \n", - "1 GRAND EST \n", - "2 BRETAGNE \n", - "3 BOURGOGNE-FRANCHE-COMTE \n", - "4 BOURGOGNE-FRANCHE-COMTE \n", - "... ... \n", - "50598 LA REUNION \n", - "50599 LA REUNION \n", - "50600 LA REUNION \n", - "50601 LA REUNION \n", - "50602 LA REUNION \n", - "\n", - "[50603 rows x 8 columns]\n" - ] - } - ], - "source": [ - "#Ouvrir un fichier CSV\n", - "#Ajout d'un séparateur des colonnes \n", - "df = pd.read_csv (r'/Users/marinegalanth/Desktop/inondation_bdd/bd_inondation/cedex.csv',sep = ';')\n", - "print(df)" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "415f6eb1", - "metadata": {}, - "outputs": [], - "source": [ - "#Renommer les colonnes sélectionnées \n", - "df = df.rename(columns={'Code INSEE': 'codepostal', 'Libellé': 'libelle', 'Code Postal / CEDEX': 'cedex'})" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "abc56e1a", - "metadata": {}, - "outputs": [], - "source": [ - "df=df[[\"codepostal\",\"libelle\",\"cedex\"]]" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "6b6f3a1c", - "metadata": {}, - "outputs": [], - "source": [ - "#Créer un dataframe\n", - "df1 = pd.DataFrame(df)" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "ae19dadc", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - " | codepostal | \n", - "libelle | \n", - "cedex | \n", - "
---|---|---|---|
0 | \n", - "73071 | \n", - "CHAMPAGNY EN VANOISE | \n", - "73350 | \n", - "
1 | \n", - "67368 | \n", - "OTTROTT | \n", - "67530 | \n", - "
2 | \n", - "35265 | \n", - "ST DOMINEUC | \n", - "35190 | \n", - "
3 | \n", - "39412 | \n", - "PESEUX | \n", - "39120 | \n", - "
4 | \n", - "39460 | \n", - "LA RIXOUSE | \n", - "39200 | \n", - "
... | \n", - "... | \n", - "... | \n", - "... | \n", - "
50598 | \n", - "97411 | \n", - "ST DENIS CEDEX | \n", - "97479 | \n", - "
50599 | \n", - "97411 | \n", - "ST DENIS CEDEX | \n", - "97489 | \n", - "
50600 | \n", - "97411 | \n", - "ST DENIS CEDEX 9 | \n", - "97707 | \n", - "
50601 | \n", - "97411 | \n", - "ST DENIS CEDEX 9 | \n", - "97717 | \n", - "
50602 | \n", - "97416 | \n", - "ST PIERRE CEDEX | \n", - "97751 | \n", - "
50603 rows × 3 columns
\n", - "