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", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
codepostallibellecedex
073071CHAMPAGNY EN VANOISE73350
167368OTTROTT67530
235265ST DOMINEUC35190
339412PESEUX39120
439460LA RIXOUSE39200
............
5059897411ST DENIS CEDEX97479
5059997411ST DENIS CEDEX97489
5060097411ST DENIS CEDEX 997707
5060197411ST DENIS CEDEX 997717
5060297416ST PIERRE CEDEX97751
\n", - "

50603 rows × 3 columns

\n", - "
" - ], - "text/plain": [ - " codepostal libelle cedex\n", - "0 73071 CHAMPAGNY EN VANOISE 73350\n", - "1 67368 OTTROTT 67530\n", - "2 35265 ST DOMINEUC 35190\n", - "3 39412 PESEUX 39120\n", - "4 39460 LA RIXOUSE 39200\n", - "... ... ... ...\n", - "50598 97411 ST DENIS CEDEX 97479\n", - "50599 97411 ST DENIS CEDEX 97489\n", - "50600 97411 ST DENIS CEDEX 9 97707\n", - "50601 97411 ST DENIS CEDEX 9 97717\n", - "50602 97416 ST PIERRE CEDEX 97751\n", - "\n", - "[50603 rows x 3 columns]" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df1" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5121a02a", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.7" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -}