75 lines
2.1 KiB
Plaintext
75 lines
2.1 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "7aa09644-4d17-4a7a-841e-3bfcfb8a8901",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Import des données\n",
|
|
"\n",
|
|
"import os\n",
|
|
"import s3fs\n",
|
|
"import pandas as pd\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 FLOWS\n",
|
|
"all_files = fs.ls(carmignac_path)\n",
|
|
"flows_files = [f for f in all_files if \"Flows\" in f and f.endswith(\".csv\")]\n",
|
|
"print(\"Fichiers Flows :\", flows_files)\n",
|
|
"\n",
|
|
"# Lire tous les fichiers dans un dictionnaire\n",
|
|
"flows_data = {}\n",
|
|
"for file_path in flows_files:\n",
|
|
" with fs.open(file_path, 'r') as f:\n",
|
|
" df = pd.read_csv(f, sep=';',low_memory=False)\n",
|
|
" flows_data[os.path.basename(file_path)] = df\n",
|
|
"\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",
|
|
"\n",
|
|
"df = aum_data['AUM ENSAE V2 -20251105.csv']\n",
|
|
"dg = flows_data['Flows ENSAE V2 -20251105.csv']"
|
|
]
|
|
}
|
|
],
|
|
"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.12"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|