{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "cf14db47", "metadata": {}, "outputs": [], "source": [ "#import de pandas\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 2, "id": "78c7afbb", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/Users/angecharbelledurand/opt/anaconda3/lib/python3.9/site-packages/IPython/core/interactiveshell.py:3444: DtypeWarning: Columns (6,14,15) have mixed types.Specify dtype option on import or set low_memory=False.\n", " exec(code_obj, self.user_global_ns, self.user_ns)\n" ] }, { "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", " \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", " \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", " \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", "
sirennicsiretdateCreationEtablissementtrancheEffectifsEtablissementanneeEffectifsEtablissementactivitePrincipaleRegistreMetiersEtablissementdateDernierTraitementEtablissementetablissementSiegenombrePeriodesEtablissementdateDebutetatAdministratifEtablissementenseigne1Etablissementenseigne2Etablissementenseigne3EtablissementdenominationUsuelleEtablissementactivitePrincipaleEtablissementnomenclatureActivitePrincipaleEtablissementcaractereEmployeurEtablissement
05420120155420120000151989-01-27 00:00:0022018.0NaN2020-08-25 10:10:13False42008-01-01 00:00:00ANaNNaNNaNNaN10.81ZNAFRev2O
15420120315420120000311900-01-01 00:00:0032018.0NaN2021-01-01 03:35:01True62008-04-23 00:00:00ANaNNaNNaNNaN70.10ZNAFRev2O
25520176165520176000161955-01-01 00:00:00122018.0NaN2021-08-01 21:30:57True42008-01-01 00:00:00ANaNNaNNaNNaN17.21ANAFRev2O
35520176325520176000321999-08-30 00:00:00122018.0NaN2020-08-25 10:10:13False42008-01-01 00:00:00ANaNNaNNaNNaN17.21ANAFRev2O
45520242165520242000161900-01-01 00:00:00122018.0NaN2021-08-01 21:30:57True42008-01-01 00:00:00ANaNNaNNaNNaN20.30ZNAFRev2O
............................................................
109567699999000538999990005000381993-07-01 00:00:00322018.0NaN2021-08-01 20:15:35True52010-12-15 00:00:00ANaNNaNNaNNaN49.41ANAFRev2O
109567799999006239999990062000392007-11-05 00:00:00122018.0NaN2021-02-23 18:21:09True22008-01-01 00:00:00ANaNNaNNaNNaN64.19ZNAFRev2O
109567899999028618999990286000181979-11-30 00:00:00222018.0NaN2021-04-04 20:15:10True42008-01-01 00:00:00ANaNNaNNaNNaN55.10ZNAFRev2O
109567999999036987999990369000872014-03-31 00:00:00212018.0NaN2021-02-23 18:21:09True12014-03-31 00:00:00ANaNNaNNaNNaN66.30ZNAFRev2O
109568099999040196999990401000962009-06-23 00:00:0032018.02712ZZ2021-03-19 03:37:02True12009-06-23 00:00:00ANaNNaNNaNNaN27.12ZNAFRev2O
\n", "

1095681 rows × 19 columns

\n", "
" ], "text/plain": [ " siren nic siret dateCreationEtablissement \\\n", "0 5420120 15 542012000015 1989-01-27 00:00:00 \n", "1 5420120 31 542012000031 1900-01-01 00:00:00 \n", "2 5520176 16 552017600016 1955-01-01 00:00:00 \n", "3 5520176 32 552017600032 1999-08-30 00:00:00 \n", "4 5520242 16 552024200016 1900-01-01 00:00:00 \n", "... ... ... ... ... \n", "1095676 999990005 38 99999000500038 1993-07-01 00:00:00 \n", "1095677 999990062 39 99999006200039 2007-11-05 00:00:00 \n", "1095678 999990286 18 99999028600018 1979-11-30 00:00:00 \n", "1095679 999990369 87 99999036900087 2014-03-31 00:00:00 \n", "1095680 999990401 96 99999040100096 2009-06-23 00:00:00 \n", "\n", " trancheEffectifsEtablissement anneeEffectifsEtablissement \\\n", "0 2 2018.0 \n", "1 3 2018.0 \n", "2 12 2018.0 \n", "3 12 2018.0 \n", "4 12 2018.0 \n", "... ... ... \n", "1095676 32 2018.0 \n", "1095677 12 2018.0 \n", "1095678 22 2018.0 \n", "1095679 21 2018.0 \n", "1095680 3 2018.0 \n", "\n", " activitePrincipaleRegistreMetiersEtablissement \\\n", "0 NaN \n", "1 NaN \n", "2 NaN \n", "3 NaN \n", "4 NaN \n", "... ... \n", "1095676 NaN \n", "1095677 NaN \n", "1095678 NaN \n", "1095679 NaN \n", "1095680 2712ZZ \n", "\n", " dateDernierTraitementEtablissement etablissementSiege \\\n", "0 2020-08-25 10:10:13 False \n", "1 2021-01-01 03:35:01 True \n", "2 2021-08-01 21:30:57 True \n", "3 2020-08-25 10:10:13 False \n", "4 2021-08-01 21:30:57 True \n", "... ... ... \n", "1095676 2021-08-01 20:15:35 True \n", "1095677 2021-02-23 18:21:09 True \n", "1095678 2021-04-04 20:15:10 True \n", "1095679 2021-02-23 18:21:09 True \n", "1095680 2021-03-19 03:37:02 True \n", "\n", " nombrePeriodesEtablissement dateDebut \\\n", "0 4 2008-01-01 00:00:00 \n", "1 6 2008-04-23 00:00:00 \n", "2 4 2008-01-01 00:00:00 \n", "3 4 2008-01-01 00:00:00 \n", "4 4 2008-01-01 00:00:00 \n", "... ... ... \n", "1095676 5 2010-12-15 00:00:00 \n", "1095677 2 2008-01-01 00:00:00 \n", "1095678 4 2008-01-01 00:00:00 \n", "1095679 1 2014-03-31 00:00:00 \n", "1095680 1 2009-06-23 00:00:00 \n", "\n", " etatAdministratifEtablissement enseigne1Etablissement \\\n", "0 A NaN \n", "1 A NaN \n", "2 A NaN \n", "3 A NaN \n", "4 A NaN \n", "... ... ... \n", "1095676 A NaN \n", "1095677 A NaN \n", "1095678 A NaN \n", "1095679 A NaN \n", "1095680 A NaN \n", "\n", " enseigne2Etablissement enseigne3Etablissement \\\n", "0 NaN NaN \n", "1 NaN NaN \n", "2 NaN NaN \n", "3 NaN NaN \n", "4 NaN NaN \n", "... ... ... \n", "1095676 NaN NaN \n", "1095677 NaN NaN \n", "1095678 NaN NaN \n", "1095679 NaN NaN \n", "1095680 NaN NaN \n", "\n", " denominationUsuelleEtablissement activitePrincipaleEtablissement \\\n", "0 NaN 10.81Z \n", "1 NaN 70.10Z \n", "2 NaN 17.21A \n", "3 NaN 17.21A \n", "4 NaN 20.30Z \n", "... ... ... \n", "1095676 NaN 49.41A \n", "1095677 NaN 64.19Z \n", "1095678 NaN 55.10Z \n", "1095679 NaN 66.30Z \n", "1095680 NaN 27.12Z \n", "\n", " nomenclatureActivitePrincipaleEtablissement \\\n", "0 NAFRev2 \n", "1 NAFRev2 \n", "2 NAFRev2 \n", "3 NAFRev2 \n", "4 NAFRev2 \n", "... ... \n", "1095676 NAFRev2 \n", "1095677 NAFRev2 \n", "1095678 NAFRev2 \n", "1095679 NAFRev2 \n", "1095680 NAFRev2 \n", "\n", " caractereEmployeurEtablissement \n", "0 O \n", "1 O \n", "2 O \n", "3 O \n", "4 O \n", "... ... \n", "1095676 O \n", "1095677 O \n", "1095678 O \n", "1095679 O \n", "1095680 O \n", "\n", "[1095681 rows x 19 columns]" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#import du fichier csv\n", "data = pd.read_csv('te_siren_admin.csv')\n", "data" ] }, { "cell_type": "code", "execution_count": 3, "id": "0ddc4c99", "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", " \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", " \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", " \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", "
sirennicsiretdateCreationEtablissementtrancheEffectifsEtablissementanneeEffectifsEtablissementactivitePrincipaleRegistreMetiersEtablissementdateDernierTraitementEtablissementetablissementSiegenombrePeriodesEtablissementdateDebutetatAdministratifEtablissementenseigne1Etablissementenseigne2Etablissementenseigne3EtablissementdenominationUsuelleEtablissementactivitePrincipaleEtablissementnomenclatureActivitePrincipaleEtablissementcaractereEmployeurEtablissement
05420120155420120000151989-01-27 00:00:0022018.0NaN2020-08-25 10:10:13False42008-01-01 00:00:00ANaNNaNNaNNaN10.81ZNAFRev2O
15420120315420120000311900-01-01 00:00:0032018.0NaN2021-01-01 03:35:01True62008-04-23 00:00:00ANaNNaNNaNNaN70.10ZNAFRev2O
25520176165520176000161955-01-01 00:00:00122018.0NaN2021-08-01 21:30:57True42008-01-01 00:00:00ANaNNaNNaNNaN17.21ANAFRev2O
35520176325520176000321999-08-30 00:00:00122018.0NaN2020-08-25 10:10:13False42008-01-01 00:00:00ANaNNaNNaNNaN17.21ANAFRev2O
45520242165520242000161900-01-01 00:00:00122018.0NaN2021-08-01 21:30:57True42008-01-01 00:00:00ANaNNaNNaNNaN20.30ZNAFRev2O
............................................................
109567699999000538999990005000381993-07-01 00:00:00322018.0NaN2021-08-01 20:15:35True52010-12-15 00:00:00ANaNNaNNaNNaN49.41ANAFRev2O
109567799999006239999990062000392007-11-05 00:00:00122018.0NaN2021-02-23 18:21:09True22008-01-01 00:00:00ANaNNaNNaNNaN64.19ZNAFRev2O
109567899999028618999990286000181979-11-30 00:00:00222018.0NaN2021-04-04 20:15:10True42008-01-01 00:00:00ANaNNaNNaNNaN55.10ZNAFRev2O
109567999999036987999990369000872014-03-31 00:00:00212018.0NaN2021-02-23 18:21:09True12014-03-31 00:00:00ANaNNaNNaNNaN66.30ZNAFRev2O
109568099999040196999990401000962009-06-23 00:00:0032018.02712ZZ2021-03-19 03:37:02True12009-06-23 00:00:00ANaNNaNNaNNaN27.12ZNAFRev2O
\n", "

965958 rows × 19 columns

\n", "
" ], "text/plain": [ " siren nic siret dateCreationEtablissement \\\n", "0 5420120 15 542012000015 1989-01-27 00:00:00 \n", "1 5420120 31 542012000031 1900-01-01 00:00:00 \n", "2 5520176 16 552017600016 1955-01-01 00:00:00 \n", "3 5520176 32 552017600032 1999-08-30 00:00:00 \n", "4 5520242 16 552024200016 1900-01-01 00:00:00 \n", "... ... ... ... ... \n", "1095676 999990005 38 99999000500038 1993-07-01 00:00:00 \n", "1095677 999990062 39 99999006200039 2007-11-05 00:00:00 \n", "1095678 999990286 18 99999028600018 1979-11-30 00:00:00 \n", "1095679 999990369 87 99999036900087 2014-03-31 00:00:00 \n", "1095680 999990401 96 99999040100096 2009-06-23 00:00:00 \n", "\n", " trancheEffectifsEtablissement anneeEffectifsEtablissement \\\n", "0 2 2018.0 \n", "1 3 2018.0 \n", "2 12 2018.0 \n", "3 12 2018.0 \n", "4 12 2018.0 \n", "... ... ... \n", "1095676 32 2018.0 \n", "1095677 12 2018.0 \n", "1095678 22 2018.0 \n", "1095679 21 2018.0 \n", "1095680 3 2018.0 \n", "\n", " activitePrincipaleRegistreMetiersEtablissement \\\n", "0 NaN \n", "1 NaN \n", "2 NaN \n", "3 NaN \n", "4 NaN \n", "... ... \n", "1095676 NaN \n", "1095677 NaN \n", "1095678 NaN \n", "1095679 NaN \n", "1095680 2712ZZ \n", "\n", " dateDernierTraitementEtablissement etablissementSiege \\\n", "0 2020-08-25 10:10:13 False \n", "1 2021-01-01 03:35:01 True \n", "2 2021-08-01 21:30:57 True \n", "3 2020-08-25 10:10:13 False \n", "4 2021-08-01 21:30:57 True \n", "... ... ... \n", "1095676 2021-08-01 20:15:35 True \n", "1095677 2021-02-23 18:21:09 True \n", "1095678 2021-04-04 20:15:10 True \n", "1095679 2021-02-23 18:21:09 True \n", "1095680 2021-03-19 03:37:02 True \n", "\n", " nombrePeriodesEtablissement dateDebut \\\n", "0 4 2008-01-01 00:00:00 \n", "1 6 2008-04-23 00:00:00 \n", "2 4 2008-01-01 00:00:00 \n", "3 4 2008-01-01 00:00:00 \n", "4 4 2008-01-01 00:00:00 \n", "... ... ... \n", "1095676 5 2010-12-15 00:00:00 \n", "1095677 2 2008-01-01 00:00:00 \n", "1095678 4 2008-01-01 00:00:00 \n", "1095679 1 2014-03-31 00:00:00 \n", "1095680 1 2009-06-23 00:00:00 \n", "\n", " etatAdministratifEtablissement enseigne1Etablissement \\\n", "0 A NaN \n", "1 A NaN \n", "2 A NaN \n", "3 A NaN \n", "4 A NaN \n", "... ... ... \n", "1095676 A NaN \n", "1095677 A NaN \n", "1095678 A NaN \n", "1095679 A NaN \n", "1095680 A NaN \n", "\n", " enseigne2Etablissement enseigne3Etablissement \\\n", "0 NaN NaN \n", "1 NaN NaN \n", "2 NaN NaN \n", "3 NaN NaN \n", "4 NaN NaN \n", "... ... ... \n", "1095676 NaN NaN \n", "1095677 NaN NaN \n", "1095678 NaN NaN \n", "1095679 NaN NaN \n", "1095680 NaN NaN \n", "\n", " denominationUsuelleEtablissement activitePrincipaleEtablissement \\\n", "0 NaN 10.81Z \n", "1 NaN 70.10Z \n", "2 NaN 17.21A \n", "3 NaN 17.21A \n", "4 NaN 20.30Z \n", "... ... ... \n", "1095676 NaN 49.41A \n", "1095677 NaN 64.19Z \n", "1095678 NaN 55.10Z \n", "1095679 NaN 66.30Z \n", "1095680 NaN 27.12Z \n", "\n", " nomenclatureActivitePrincipaleEtablissement \\\n", "0 NAFRev2 \n", "1 NAFRev2 \n", "2 NAFRev2 \n", "3 NAFRev2 \n", "4 NAFRev2 \n", "... ... \n", "1095676 NAFRev2 \n", "1095677 NAFRev2 \n", "1095678 NAFRev2 \n", "1095679 NAFRev2 \n", "1095680 NAFRev2 \n", "\n", " caractereEmployeurEtablissement \n", "0 O \n", "1 O \n", "2 O \n", "3 O \n", "4 O \n", "... ... \n", "1095676 O \n", "1095677 O \n", "1095678 O \n", "1095679 O \n", "1095680 O \n", "\n", "[965958 rows x 19 columns]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#filtrer sur les etatAdministratifEtablissement Actif\n", "data=data.loc[data.etatAdministratifEtablissement=='A']\n", "data" ] }, { "cell_type": "code", "execution_count": 7, "id": "ca5a157e", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "DataFrame is written to Excel File successfully.\n" ] } ], "source": [ "#export du fichier en .xlsx\n", "file_name = 'SirenAdminNet.xlsx'\n", "data.to_excel(file_name)\n", "print('DataFrame is written to Excel File successfully.')" ] }, { "cell_type": "code", "execution_count": null, "id": "d6213677", "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 }