From 224d45b16636e31da35b748397012c6765b14464 Mon Sep 17 00:00:00 2001 From: lmoraine-ensae Date: Tue, 25 Nov 2025 14:30:27 +0000 Subject: [PATCH] essai --- .ipynb_checkpoints/Essai-checkpoint.ipynb | 281 +++++++++++++++++++ .ipynb_checkpoints/test_upload-checkpoint.py | 0 Essai.ipynb | 281 +++++++++++++++++++ 3 files changed, 562 insertions(+) create mode 100644 .ipynb_checkpoints/Essai-checkpoint.ipynb create mode 100644 .ipynb_checkpoints/test_upload-checkpoint.py create mode 100644 Essai.ipynb diff --git a/.ipynb_checkpoints/Essai-checkpoint.ipynb b/.ipynb_checkpoints/Essai-checkpoint.ipynb new file mode 100644 index 0000000..825f0e2 --- /dev/null +++ b/.ipynb_checkpoints/Essai-checkpoint.ipynb @@ -0,0 +1,281 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 25, + "id": "dad4ac5b-b66f-4eab-acbf-51dc708616ef", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Fichiers AUM : ['projet-bdc-data/carmignac/AUM ENSAE V1 -20251027.csv', 'projet-bdc-data/carmignac/AUM ENSAE V2 -20251105.csv']\n" + ] + } + ], + "source": [ + "import os\n", + "import s3fs\n", + "\n", + "s3_ENDPOINT_URL = \"https://\" + os.environ[\"AWS_S3_ENDPOINT\"]\n", + "\n", + "fs = s3fs.S3FileSystem(client_kwargs={'endpoint_url': s3_ENDPOINT_URL})\n", + "\n", + "BUCKET = \"projet-bdc-data\"\n", + "carmignac_path = \"projet-bdc-data/carmignac\"\n", + "\n", + "# Liste des fichiers AUM\n", + "all_files = fs.ls(carmignac_path)\n", + "aum_files = [f for f in all_files if \"AUM\" in f and f.endswith(\".csv\")]\n", + "print(\"Fichiers AUM :\", aum_files)\n", + "\n", + "# Lire tous les fichiers dans un dictionnaire\n", + "aum_data = {}\n", + "for file_path in aum_files:\n", + " with fs.open(file_path, 'r') as f:\n", + " df = pd.read_csv(f, sep=';',low_memory=False)\n", + " aum_data[os.path.basename(file_path)] = df\n" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "68903172-d4f8-4c6e-96f8-578c5b1afe23", + "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", + "
Agreement - CodeCompany - IdCompany - Ultimate Parent IdRegistrar Account - IDRegistrar Account - RegionRegistrarAccount - CountryProduct - Asset TypeProduct - StrategyProduct - Legal StatusProduct - Is Dedie ?Product - FundProduct - Shareclass TypeProduct - Shareclass CurrencyProduct - IsinCentralisation DateQuantity - AUMValue - AUM CCYValue - AUM €
0003166166200000647FranceFranceDiversifiedPatrimoineFCPNOCarmignac PatrimoineAEURFR00101351032015-03-3135.36824648.666624648.6666
1003166166200000647FranceFranceDiversifiedPatrimoineFCPNOCarmignac PatrimoineAEURFR00101351032015-11-3035.36822413.055322413.0553
2003166166200000647FranceFranceDiversifiedPatrimoineFCPNOCarmignac PatrimoineAEURFR00101351032015-12-3135.36822051.240622051.2406
3003166166200000647FranceFranceDiversifiedPatrimoineFCPNOCarmignac PatrimoineAEURFR00101351032016-03-3135.36821626.117321626.1173
4003166166200000647FranceFranceDiversifiedPatrimoineFCPNOCarmignac PatrimoineAEURFR00101351032016-11-3035.36822489.450222489.4502
\n", + "
" + ], + "text/plain": [ + " Agreement - Code Company - Id Company - Ultimate Parent Id \\\n", + "0 003 166 166 \n", + "1 003 166 166 \n", + "2 003 166 166 \n", + "3 003 166 166 \n", + "4 003 166 166 \n", + "\n", + " Registrar Account - ID Registrar Account - Region \\\n", + "0 200000647 France \n", + "1 200000647 France \n", + "2 200000647 France \n", + "3 200000647 France \n", + "4 200000647 France \n", + "\n", + " RegistrarAccount - Country Product - Asset Type Product - Strategy \\\n", + "0 France Diversified Patrimoine \n", + "1 France Diversified Patrimoine \n", + "2 France Diversified Patrimoine \n", + "3 France Diversified Patrimoine \n", + "4 France Diversified Patrimoine \n", + "\n", + " Product - Legal Status Product - Is Dedie ? Product - Fund \\\n", + "0 FCP NO Carmignac Patrimoine \n", + "1 FCP NO Carmignac Patrimoine \n", + "2 FCP NO Carmignac Patrimoine \n", + "3 FCP NO Carmignac Patrimoine \n", + "4 FCP NO Carmignac Patrimoine \n", + "\n", + " Product - Shareclass Type Product - Shareclass Currency Product - Isin \\\n", + "0 A EUR FR0010135103 \n", + "1 A EUR FR0010135103 \n", + "2 A EUR FR0010135103 \n", + "3 A EUR FR0010135103 \n", + "4 A EUR FR0010135103 \n", + "\n", + " Centralisation Date Quantity - AUM Value - AUM CCY Value - AUM € \n", + "0 2015-03-31 35.368 24648.6666 24648.6666 \n", + "1 2015-11-30 35.368 22413.0553 22413.0553 \n", + "2 2015-12-31 35.368 22051.2406 22051.2406 \n", + "3 2016-03-31 35.368 21626.1173 21626.1173 \n", + "4 2016-11-30 35.368 22489.4502 22489.4502 " + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "aum_data['AUM ENSAE V2 -20251105.csv'].head()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "22042f8f-1492-44a4-a492-5074ef1dc9f6", + "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.13.8" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/.ipynb_checkpoints/test_upload-checkpoint.py b/.ipynb_checkpoints/test_upload-checkpoint.py new file mode 100644 index 0000000..e69de29 diff --git a/Essai.ipynb b/Essai.ipynb new file mode 100644 index 0000000..825f0e2 --- /dev/null +++ b/Essai.ipynb @@ -0,0 +1,281 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 25, + "id": "dad4ac5b-b66f-4eab-acbf-51dc708616ef", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Fichiers AUM : ['projet-bdc-data/carmignac/AUM ENSAE V1 -20251027.csv', 'projet-bdc-data/carmignac/AUM ENSAE V2 -20251105.csv']\n" + ] + } + ], + "source": [ + "import os\n", + "import s3fs\n", + "\n", + "s3_ENDPOINT_URL = \"https://\" + os.environ[\"AWS_S3_ENDPOINT\"]\n", + "\n", + "fs = s3fs.S3FileSystem(client_kwargs={'endpoint_url': s3_ENDPOINT_URL})\n", + "\n", + "BUCKET = \"projet-bdc-data\"\n", + "carmignac_path = \"projet-bdc-data/carmignac\"\n", + "\n", + "# Liste des fichiers AUM\n", + "all_files = fs.ls(carmignac_path)\n", + "aum_files = [f for f in all_files if \"AUM\" in f and f.endswith(\".csv\")]\n", + "print(\"Fichiers AUM :\", aum_files)\n", + "\n", + "# Lire tous les fichiers dans un dictionnaire\n", + "aum_data = {}\n", + "for file_path in aum_files:\n", + " with fs.open(file_path, 'r') as f:\n", + " df = pd.read_csv(f, sep=';',low_memory=False)\n", + " aum_data[os.path.basename(file_path)] = df\n" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "68903172-d4f8-4c6e-96f8-578c5b1afe23", + "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", + "
Agreement - CodeCompany - IdCompany - Ultimate Parent IdRegistrar Account - IDRegistrar Account - RegionRegistrarAccount - CountryProduct - Asset TypeProduct - StrategyProduct - Legal StatusProduct - Is Dedie ?Product - FundProduct - Shareclass TypeProduct - Shareclass CurrencyProduct - IsinCentralisation DateQuantity - AUMValue - AUM CCYValue - AUM €
0003166166200000647FranceFranceDiversifiedPatrimoineFCPNOCarmignac PatrimoineAEURFR00101351032015-03-3135.36824648.666624648.6666
1003166166200000647FranceFranceDiversifiedPatrimoineFCPNOCarmignac PatrimoineAEURFR00101351032015-11-3035.36822413.055322413.0553
2003166166200000647FranceFranceDiversifiedPatrimoineFCPNOCarmignac PatrimoineAEURFR00101351032015-12-3135.36822051.240622051.2406
3003166166200000647FranceFranceDiversifiedPatrimoineFCPNOCarmignac PatrimoineAEURFR00101351032016-03-3135.36821626.117321626.1173
4003166166200000647FranceFranceDiversifiedPatrimoineFCPNOCarmignac PatrimoineAEURFR00101351032016-11-3035.36822489.450222489.4502
\n", + "
" + ], + "text/plain": [ + " Agreement - Code Company - Id Company - Ultimate Parent Id \\\n", + "0 003 166 166 \n", + "1 003 166 166 \n", + "2 003 166 166 \n", + "3 003 166 166 \n", + "4 003 166 166 \n", + "\n", + " Registrar Account - ID Registrar Account - Region \\\n", + "0 200000647 France \n", + "1 200000647 France \n", + "2 200000647 France \n", + "3 200000647 France \n", + "4 200000647 France \n", + "\n", + " RegistrarAccount - Country Product - Asset Type Product - Strategy \\\n", + "0 France Diversified Patrimoine \n", + "1 France Diversified Patrimoine \n", + "2 France Diversified Patrimoine \n", + "3 France Diversified Patrimoine \n", + "4 France Diversified Patrimoine \n", + "\n", + " Product - Legal Status Product - Is Dedie ? Product - Fund \\\n", + "0 FCP NO Carmignac Patrimoine \n", + "1 FCP NO Carmignac Patrimoine \n", + "2 FCP NO Carmignac Patrimoine \n", + "3 FCP NO Carmignac Patrimoine \n", + "4 FCP NO Carmignac Patrimoine \n", + "\n", + " Product - Shareclass Type Product - Shareclass Currency Product - Isin \\\n", + "0 A EUR FR0010135103 \n", + "1 A EUR FR0010135103 \n", + "2 A EUR FR0010135103 \n", + "3 A EUR FR0010135103 \n", + "4 A EUR FR0010135103 \n", + "\n", + " Centralisation Date Quantity - AUM Value - AUM CCY Value - AUM € \n", + "0 2015-03-31 35.368 24648.6666 24648.6666 \n", + "1 2015-11-30 35.368 22413.0553 22413.0553 \n", + "2 2015-12-31 35.368 22051.2406 22051.2406 \n", + "3 2016-03-31 35.368 21626.1173 21626.1173 \n", + "4 2016-11-30 35.368 22489.4502 22489.4502 " + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "aum_data['AUM ENSAE V2 -20251105.csv'].head()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "22042f8f-1492-44a4-a492-5074ef1dc9f6", + "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.13.8" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}