mudaças pré formatação do pc

This commit is contained in:
João Herculano
2025-10-24 15:54:54 -03:00
parent 15fa59651c
commit 7221f41ebb
133 changed files with 5195259 additions and 9891 deletions
+98 -40
View File
@@ -5,40 +5,25 @@
"execution_count": 1,
"id": "fd67cc1a",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"c:\\Users\\joao.herculano\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\openpyxl\\worksheet\\_reader.py:329: UserWarning: Unknown extension is not supported and will be removed\n",
" warn(msg)\n",
"c:\\Users\\joao.herculano\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\openpyxl\\worksheet\\_reader.py:329: UserWarning: Unknown extension is not supported and will be removed\n",
" warn(msg)\n",
"c:\\Users\\joao.herculano\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\openpyxl\\worksheet\\_reader.py:329: UserWarning: Unknown extension is not supported and will be removed\n",
" warn(msg)\n",
"c:\\Users\\joao.herculano\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\openpyxl\\worksheet\\_reader.py:329: UserWarning: Unknown extension is not supported and will be removed\n",
" warn(msg)\n"
]
}
],
"outputs": [],
"source": [
"import os\n",
"import glob\n",
"import pandas as pd\n",
"\n",
"# Directory path\n",
"folder_path = r\"C:\\Users\\joao.herculano\\GRUPO GINSENG\\Assistência Suprimentos - 2025\\SUPRIMENTOS\\BD_LANÇAMENTOS\\BOT\\Bot - C13\\LANÇAMENTOS\\devolutiva comercial\"\n",
"folder_path = r\"C:\\Users\\joao.herculano\\GRUPO GINSENG\\Assistência Suprimentos - 2025\\SUPRIMENTOS\\KITS_COMBOS2025\\BOTICARIO\\COMBO NATAL 2025\\202517\\nova versão emitida pelo joao\\devolutiva analista\"\n",
"# Collect files\n",
"file_paths = glob.glob(os.path.join(folder_path, \"*.xls\")) + glob.glob(os.path.join(folder_path, \"*.xlsx\"))\n",
"\n",
"# Required columns\n",
"required_columns = [\"PDV\", \"PRODUTO LANÇAMENTO\", \"SUGESTÃO COMERCIAL\"]\n",
"required_columns = [\"PDV\", \"Cod_Combo\", \"SUGESTÃO ABASTECIMENTO\"]\n",
"\n",
"# Load files\n",
"dfs = []\n",
"for file_path in file_paths:\n",
" try:\n",
" df = pd.read_excel(file_path,sheet_name='Sheet1')\n",
" df = pd.read_excel(file_path,sheet_name='Planilha2',skiprows=1)\n",
" \n",
" missing = [col for col in required_columns if col not in df.columns]\n",
" \n",
@@ -61,30 +46,19 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "c4c50096",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"np.int64(82418)"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"\n",
"\n",
"combined_df['SUGESTÃO COMERCIAL'].isna().sum()"
"combined_df['SUGESTÃO ABASTECIMENTO'].isna().sum()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "3e1ada65",
"metadata": {},
"outputs": [],
@@ -94,32 +68,116 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "f5968d9a",
"metadata": {},
"outputs": [],
"source": [
"combined_df['chavers'] = combined_df['PDV'].astype('str') + combined_df['PRODUTO LANÇAMENTO'].astype('str')"
"combined_df['chavers'] = combined_df['PDV'].astype('str') + combined_df['Cod_Combo'].astype('str')"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"id": "fd6a08e7",
"metadata": {},
"outputs": [],
"source": [
"combined_df['chavers'] = combined_df['chavers'].str.replace('.','')"
"combined_df['chavers'] = combined_df['chavers'].str.replace('.','')\n",
"\n",
"combined_df['SUGESTÃO ABASTECIMENTO'] = combined_df['SUGESTÃO ABASTECIMENTO'].str.replace('.','')"
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"id": "710c4d82",
"metadata": {},
"outputs": [],
"source": [
"combined_df"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fdab0c56",
"metadata": {},
"outputs": [],
"source": [
"combined_df = combined_df[combined_df['SUGESTÃO ABASTECIMENTO'].notna()]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "db1401b0",
"metadata": {},
"outputs": [],
"source": [
"#combined_df = combined_df[combined_df['SUGESTÃO ABASTECIMENTO']!='*']"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "42a44a69",
"metadata": {},
"outputs": [],
"source": [
"combined_df"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7c929263",
"metadata": {},
"outputs": [],
"source": [
"combined_df['SUGESTÃO ABASTECIMENTO'] = combined_df['SUGESTÃO ABASTECIMENTO'].astype('int64')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d57ed8ef",
"metadata": {},
"outputs": [],
"source": [
"\n",
"\n",
"combined_df = combined_df[combined_df['SUGESTÃO ABASTECIMENTO']>0]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b1b7430f",
"metadata": {},
"outputs": [],
"source": [
"combined_df = combined_df[[\"chavers\",\"PDV\", \"Cod_Combo\", \"SUGESTÃO ABASTECIMENTO\"]]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5b09ab9c",
"metadata": {},
"outputs": [],
"source": [
"combined_df"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "b6eee60e",
"metadata": {},
"outputs": [],
"source": [
"combined_df.to_excel(r\"C:\\Users\\joao.herculano\\GRUPO GINSENG\\Assistência Suprimentos - 2025\\SUPRIMENTOS\\BD_LANÇAMENTOS\\BOT\\Bot - C13\\LANÇAMENTOS\\compilado_comercial_BOTI!!!.xlsx\",index=False)"
"combined_df.to_excel(r\"C:\\Users\\joao.herculano\\GRUPO GINSENG\\Assistência Suprimentos - 2025\\SUPRIMENTOS\\KITS_COMBOS2025\\BOTICARIO\\COMBO NATAL 2025\\202517\\nova versão emitida pelo joao\\compilado_Analista.xlsx\",index=False)"
]
},
{
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff