{ "cells": [ { "cell_type": "code", "execution_count": 6, "id": "33e83475", "metadata": {}, "outputs": [], "source": [ "#import de la bibliothèque pandas\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 7, "id": "f091507f", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/Users/angecharbelledurand/opt/anaconda3/lib/python3.9/site-packages/IPython/core/interactiveshell.py:3444: DtypeWarning: Columns (7,15,16) 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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Unnamed: 0sirennicsiretdateCreationEtablissementtrancheEffectifsEtablissementanneeEffectifsEtablissementactivitePrincipaleRegistreMetiersEtablissementdateDernierTraitementEtablissementetablissementSiegenombrePeriodesEtablissementdateDebutetatAdministratifEtablissementenseigne1Etablissementenseigne2Etablissementenseigne3EtablissementdenominationUsuelleEtablissementactivitePrincipaleEtablissementnomenclatureActivitePrincipaleEtablissementcaractereEmployeurEtablissement
005420120155420120000151989-01-27 00:00:0022018.0NaN2020-08-25 10:10:13False42008-01-01 00:00:00ANaNNaNNaNNaN10.81ZNAFRev2O
115420120315420120000311900-01-01 00:00:0032018.0NaN2021-01-01 03:35:01True62008-04-23 00:00:00ANaNNaNNaNNaN70.10ZNAFRev2O
225520176165520176000161955-01-01 00:00:00122018.0NaN2021-08-01 21:30:57True42008-01-01 00:00:00ANaNNaNNaNNaN17.21ANAFRev2O
335520176325520176000321999-08-30 00:00:00122018.0NaN2020-08-25 10:10:13False42008-01-01 00:00:00ANaNNaNNaNNaN17.21ANAFRev2O
445520242165520242000161900-01-01 00:00:00122018.0NaN2021-08-01 21:30:57True42008-01-01 00:00:00ANaNNaNNaNNaN20.30ZNAFRev2O
...............................................................
965953109567699999000538999990005000381993-07-01 00:00:00322018.0NaN2021-08-01 20:15:35True52010-12-15 00:00:00ANaNNaNNaNNaN49.41ANAFRev2O
965954109567799999006239999990062000392007-11-05 00:00:00122018.0NaN2021-02-23 18:21:09True22008-01-01 00:00:00ANaNNaNNaNNaN64.19ZNAFRev2O
965955109567899999028618999990286000181979-11-30 00:00:00222018.0NaN2021-04-04 20:15:10True42008-01-01 00:00:00ANaNNaNNaNNaN55.10ZNAFRev2O
965956109567999999036987999990369000872014-03-31 00:00:00212018.0NaN2021-02-23 18:21:09True12014-03-31 00:00:00ANaNNaNNaNNaN66.30ZNAFRev2O
965957109568099999040196999990401000962009-06-23 00:00:0032018.02712ZZ2021-03-19 03:37:02True12009-06-23 00:00:00ANaNNaNNaNNaN27.12ZNAFRev2O
\n", "

965958 rows × 20 columns

\n", "
" ], "text/plain": [ " Unnamed: 0 siren nic siret dateCreationEtablissement \\\n", "0 0 5420120 15 542012000015 1989-01-27 00:00:00 \n", "1 1 5420120 31 542012000031 1900-01-01 00:00:00 \n", "2 2 5520176 16 552017600016 1955-01-01 00:00:00 \n", "3 3 5520176 32 552017600032 1999-08-30 00:00:00 \n", "4 4 5520242 16 552024200016 1900-01-01 00:00:00 \n", "... ... ... ... ... ... \n", "965953 1095676 999990005 38 99999000500038 1993-07-01 00:00:00 \n", "965954 1095677 999990062 39 99999006200039 2007-11-05 00:00:00 \n", "965955 1095678 999990286 18 99999028600018 1979-11-30 00:00:00 \n", "965956 1095679 999990369 87 99999036900087 2014-03-31 00:00:00 \n", "965957 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", "965953 32 2018.0 \n", "965954 12 2018.0 \n", "965955 22 2018.0 \n", "965956 21 2018.0 \n", "965957 3 2018.0 \n", "\n", " activitePrincipaleRegistreMetiersEtablissement \\\n", "0 NaN \n", "1 NaN \n", "2 NaN \n", "3 NaN \n", "4 NaN \n", "... ... \n", "965953 NaN \n", "965954 NaN \n", "965955 NaN \n", "965956 NaN \n", "965957 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", "965953 2021-08-01 20:15:35 True \n", "965954 2021-02-23 18:21:09 True \n", "965955 2021-04-04 20:15:10 True \n", "965956 2021-02-23 18:21:09 True \n", "965957 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", "965953 5 2010-12-15 00:00:00 \n", "965954 2 2008-01-01 00:00:00 \n", "965955 4 2008-01-01 00:00:00 \n", "965956 1 2014-03-31 00:00:00 \n", "965957 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", "965953 A NaN \n", "965954 A NaN \n", "965955 A NaN \n", "965956 A NaN \n", "965957 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", "965953 NaN NaN \n", "965954 NaN NaN \n", "965955 NaN NaN \n", "965956 NaN NaN \n", "965957 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", "965953 NaN 49.41A \n", "965954 NaN 64.19Z \n", "965955 NaN 55.10Z \n", "965956 NaN 66.30Z \n", "965957 NaN 27.12Z \n", "\n", " nomenclatureActivitePrincipaleEtablissement \\\n", "0 NAFRev2 \n", "1 NAFRev2 \n", "2 NAFRev2 \n", "3 NAFRev2 \n", "4 NAFRev2 \n", "... ... \n", "965953 NAFRev2 \n", "965954 NAFRev2 \n", "965955 NAFRev2 \n", "965956 NAFRev2 \n", "965957 NAFRev2 \n", "\n", " caractereEmployeurEtablissement \n", "0 O \n", "1 O \n", "2 O \n", "3 O \n", "4 O \n", "... ... \n", "965953 O \n", "965954 O \n", "965955 O \n", "965956 O \n", "965957 O \n", "\n", "[965958 rows x 20 columns]" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#import du fichier csv\n", "dt = pd.read_csv('SirenAdminNet.csv')\n", "dt" ] }, { "cell_type": "code", "execution_count": 8, "id": "b430c37b", "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Unnamed: 0sirennicsiretdateCreationEtablissementtrancheEffectifsEtablissementanneeEffectifsEtablissementactivitePrincipaleRegistreMetiersEtablissementdateDernierTraitementEtablissementetablissementSiegenombrePeriodesEtablissementdateDebutetatAdministratifEtablissementenseigne1Etablissementenseigne2Etablissementenseigne3EtablissementdenominationUsuelleEtablissementactivitePrincipaleEtablissementnomenclatureActivitePrincipaleEtablissementcaractereEmployeurEtablissement
005420120155420120000151989-01-27 00:00:0022018.0NaN2020-08-25 10:10:13False42008-01-01 00:00:00ANaNNaNNaNNaN10.81ZNAFRev2O
115420120315420120000311900-01-01 00:00:0032018.0NaN2021-01-01 03:35:01True62008-04-23 00:00:00ANaNNaNNaNNaN70.10ZNAFRev2O
225520176165520176000161955-01-01 00:00:00122018.0NaN2021-08-01 21:30:57True42008-01-01 00:00:00ANaNNaNNaNNaN17.21ANAFRev2O
335520176325520176000321999-08-30 00:00:00122018.0NaN2020-08-25 10:10:13False42008-01-01 00:00:00ANaNNaNNaNNaN17.21ANAFRev2O
445520242165520242000161900-01-01 00:00:00122018.0NaN2021-08-01 21:30:57True42008-01-01 00:00:00ANaNNaNNaNNaN20.30ZNAFRev2O
...............................................................
965953109567699999000538999990005000381993-07-01 00:00:00322018.0NaN2021-08-01 20:15:35True52010-12-15 00:00:00ANaNNaNNaNNaN49.41ANAFRev2O
965954109567799999006239999990062000392007-11-05 00:00:00122018.0NaN2021-02-23 18:21:09True22008-01-01 00:00:00ANaNNaNNaNNaN64.19ZNAFRev2O
965955109567899999028618999990286000181979-11-30 00:00:00222018.0NaN2021-04-04 20:15:10True42008-01-01 00:00:00ANaNNaNNaNNaN55.10ZNAFRev2O
965956109567999999036987999990369000872014-03-31 00:00:00212018.0NaN2021-02-23 18:21:09True12014-03-31 00:00:00ANaNNaNNaNNaN66.30ZNAFRev2O
965957109568099999040196999990401000962009-06-23 00:00:0032018.02712ZZ2021-03-19 03:37:02True12009-06-23 00:00:00ANaNNaNNaNNaN27.12ZNAFRev2O
\n", "

832575 rows × 20 columns

\n", "
" ], "text/plain": [ " Unnamed: 0 siren nic siret dateCreationEtablissement \\\n", "0 0 5420120 15 542012000015 1989-01-27 00:00:00 \n", "1 1 5420120 31 542012000031 1900-01-01 00:00:00 \n", "2 2 5520176 16 552017600016 1955-01-01 00:00:00 \n", "3 3 5520176 32 552017600032 1999-08-30 00:00:00 \n", "4 4 5520242 16 552024200016 1900-01-01 00:00:00 \n", "... ... ... ... ... ... \n", "965953 1095676 999990005 38 99999000500038 1993-07-01 00:00:00 \n", "965954 1095677 999990062 39 99999006200039 2007-11-05 00:00:00 \n", "965955 1095678 999990286 18 99999028600018 1979-11-30 00:00:00 \n", "965956 1095679 999990369 87 99999036900087 2014-03-31 00:00:00 \n", "965957 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", "965953 32 2018.0 \n", "965954 12 2018.0 \n", "965955 22 2018.0 \n", "965956 21 2018.0 \n", "965957 3 2018.0 \n", "\n", " activitePrincipaleRegistreMetiersEtablissement \\\n", "0 NaN \n", "1 NaN \n", "2 NaN \n", "3 NaN \n", "4 NaN \n", "... ... \n", "965953 NaN \n", "965954 NaN \n", "965955 NaN \n", "965956 NaN \n", "965957 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", "965953 2021-08-01 20:15:35 True \n", "965954 2021-02-23 18:21:09 True \n", "965955 2021-04-04 20:15:10 True \n", "965956 2021-02-23 18:21:09 True \n", "965957 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", "965953 5 2010-12-15 00:00:00 \n", "965954 2 2008-01-01 00:00:00 \n", "965955 4 2008-01-01 00:00:00 \n", "965956 1 2014-03-31 00:00:00 \n", "965957 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", "965953 A NaN \n", "965954 A NaN \n", "965955 A NaN \n", "965956 A NaN \n", "965957 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", "965953 NaN NaN \n", "965954 NaN NaN \n", "965955 NaN NaN \n", "965956 NaN NaN \n", "965957 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", "965953 NaN 49.41A \n", "965954 NaN 64.19Z \n", "965955 NaN 55.10Z \n", "965956 NaN 66.30Z \n", "965957 NaN 27.12Z \n", "\n", " nomenclatureActivitePrincipaleEtablissement \\\n", "0 NAFRev2 \n", "1 NAFRev2 \n", "2 NAFRev2 \n", "3 NAFRev2 \n", "4 NAFRev2 \n", "... ... \n", "965953 NAFRev2 \n", "965954 NAFRev2 \n", "965955 NAFRev2 \n", "965956 NAFRev2 \n", "965957 NAFRev2 \n", "\n", " caractereEmployeurEtablissement \n", "0 O \n", "1 O \n", "2 O \n", "3 O \n", "4 O \n", "... ... \n", "965953 O \n", "965954 O \n", "965955 O \n", "965956 O \n", "965957 O \n", "\n", "[832575 rows x 20 columns]" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#filtrer sur les caractereEmployeurEtablissement O : unité légale employeuse\n", "dt=dt.loc[dt.caractereEmployeurEtablissement=='O']\n", "dt" ] }, { "cell_type": "code", "execution_count": 11, "id": "b16cdb56", "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 = 'SirenAdminNetFinal.xlsx'\n", "dt.to_excel(file_name)\n", "print('DataFrame is written to Excel File successfully.')" ] }, { "cell_type": "code", "execution_count": null, "id": "9ecdee25", "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 }