{ "cells": [ { "cell_type": "code", "execution_count": 38, "id": "a9aff7f8", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "import glob\n", "import os" ] }, { "cell_type": "code", "execution_count": 39, "id": "b2dcfc46", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\joao.herculano\\AppData\\Local\\Temp\\ipykernel_7172\\2177111484.py:1: DtypeWarning: Columns (2,15,20) have mixed types. Specify dtype option on import or set low_memory=False.\n", " df_estoque = pd.read_csv(r\"C:\\Users\\joao.herculano\\OneDrive - GRUPO GINSENG\\Documentos\\CONSULTAS BANCO DE DADOS\\ESTOQUE ULTIMO DIA MÊS JAN-SET 20251001.csv\",sep=';')\n" ] } ], "source": [ "df_estoque = pd.read_csv(r\"C:\\Users\\joao.herculano\\OneDrive - GRUPO GINSENG\\Documentos\\CONSULTAS BANCO DE DADOS\\ESTOQUE ULTIMO DIA MÊS JAN-SET 20251001.csv\",sep=';')" ] }, { "cell_type": "code", "execution_count": 40, "id": "a62908ad", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "CATEGORIA\n", "MAQUIAGEM 844751\n", "SUPORTE À VENDA 512586\n", "GIFTS 471481\n", "CABELOS 361316\n", "CUIDADOS COM A PELE 349341\n", "PERFUMARIA 344606\n", "ACESSÓRIOS 194688\n", "DESODORANTES 189907\n", "SABONETE CORPO 153660\n", "EMBALAGENS 152144\n", "CUIDADOS FACIAIS 93892\n", "INFANTIL 87526\n", "ÓLEOS 42178\n", "CUIDADOS COM A BARBA 35728\n", "SOLAR 23415\n", "HOME CARE 14213\n", "UNHAS 12543\n", "CUIDADOS PETS 5753\n", "MAQUIAGEM (Desativado) 288\n", "ALIMENTOS 70\n", "DESATIVADA 36\n", "DESODORANTES (Desativado) 2\n", "Name: count, dtype: int64" ] }, "execution_count": 40, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_estoque['CATEGORIA'].value_counts()" ] }, { "cell_type": "code", "execution_count": 41, "id": "ce85b49f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(1037441, 21)" ] }, "execution_count": 41, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_estoque[df_estoque['ESTOQUE ATUAL']>0].shape" ] }, { "cell_type": "code", "execution_count": 4, "id": "b17dd732", "metadata": {}, "outputs": [], "source": [ "df_estoque = df_estoque[df_estoque['ESTOQUE ATUAL']>0]" ] }, { "cell_type": "code", "execution_count": 5, "id": "5fcb34b6", "metadata": {}, "outputs": [], "source": [ "df_estoque = df_estoque[(df_estoque['CATEGORIA']!='SUPORTE À VENDA')&(df_estoque['CATEGORIA']!='EMBALAGENS')]" ] }, { "cell_type": "code", "execution_count": 6, "id": "bb7e9735", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['id', 'SKU', 'SKU_PARA', 'DESCRICAO', 'CATEGORIA', 'CLASSE',\n", " 'FASES PRODUTO', 'LANCAMENTO', 'DESATIVACAO', 'PDV', 'ESTOQUE ATUAL',\n", " 'ESTOQUE EM TRANSITO', 'PEDIDO PENDENTE', 'COBERTURA ALVO',\n", " 'ESTOQUE DE SEGURANCA', 'DDV PREVISTO', 'COBERTURA ATUAL',\n", " 'COBERTURA ATUAL + TRANSITO', 'COBERTURA PROJETADA', 'data_estoque',\n", " 'ORIGEM'],\n", " dtype='object')" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_estoque.columns" ] }, { "cell_type": "code", "execution_count": 7, "id": "2556e08e", "metadata": {}, "outputs": [], "source": [ "df_estoque = df_estoque.drop(columns=['id'])" ] }, { "cell_type": "code", "execution_count": 8, "id": "d5a5fdcc", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0 2025-01-31\n", "1 2025-01-31\n", "2 2025-01-31\n", "3 2025-01-31\n", "4 2025-01-31\n", "Name: data_estoque, dtype: object" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_estoque['data_estoque'].head()" ] }, { "cell_type": "code", "execution_count": 9, "id": "15da0447", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0 1\n", "1 1\n", "2 1\n", "3 1\n", "4 1\n", "Name: mes_data, dtype: object" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_estoque['mes_data'] = df_estoque['data_estoque'].str[6]\n", "df_estoque['mes_data'].head()" ] }, { "cell_type": "code", "execution_count": 10, "id": "24094346", "metadata": {}, "outputs": [], "source": [ "df_estoque = df_estoque[df_estoque['mes_data'] != '1']" ] }, { "cell_type": "code", "execution_count": 11, "id": "feb905e0", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "📂 Lendo pasta: draft 2\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\joao.herculano\\AppData\\Local\\Temp\\ipykernel_7172\\441796314.py:23: DtypeWarning: Columns (6,7) have mixed types. Specify dtype option on import or set low_memory=False.\n", " df = pd.read_csv(file_path, encoding=\"utf-8\", sep=\",\") # ajuste o sep se precisar (; ou \\t)\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📂 Lendo pasta: draft 3\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\joao.herculano\\AppData\\Local\\Temp\\ipykernel_7172\\441796314.py:23: DtypeWarning: Columns (6) have mixed types. Specify dtype option on import or set low_memory=False.\n", " df = pd.read_csv(file_path, encoding=\"utf-8\", sep=\",\") # ajuste o sep se precisar (; ou \\t)\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📂 Lendo pasta: draft 4\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\joao.herculano\\AppData\\Local\\Temp\\ipykernel_7172\\441796314.py:23: DtypeWarning: Columns (7) have mixed types. Specify dtype option on import or set low_memory=False.\n", " df = pd.read_csv(file_path, encoding=\"utf-8\", sep=\",\") # ajuste o sep se precisar (; ou \\t)\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📂 Lendo pasta: draft 5\n", "✅ DataFrame final tem 447847 linhas e 51 colunas.\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\joao.herculano\\AppData\\Local\\Temp\\ipykernel_7172\\441796314.py:23: DtypeWarning: Columns (7) have mixed types. Specify dtype option on import or set low_memory=False.\n", " df = pd.read_csv(file_path, encoding=\"utf-8\", sep=\",\") # ajuste o sep se precisar (; ou \\t)\n" ] } ], "source": [ "import os\n", "import glob\n", "import pandas as pd\n", "\n", "# Caminho base\n", "folder_path1 = r'C:\\Users\\joao.herculano\\GRUPO GINSENG\\Assistência Suprimentos - 2025\\CODIGOS\\estudo estoque desativado\\desativados draft'\n", "\n", "all_dfs = []\n", "\n", "# Percorre cada subpasta\n", "for folder in os.listdir(folder_path1):\n", " folder_full = os.path.join(folder_path1, folder)\n", " \n", " # Garante que é pasta\n", " if os.path.isdir(folder_full):\n", " print(f\"📂 Lendo pasta: {folder}\")\n", "\n", " # Pega todos os CSVs\n", " file_paths = glob.glob(os.path.join(folder_full, \"*.csv\"))\n", "\n", " for file_path in file_paths:\n", " try:\n", " df = pd.read_csv(file_path, encoding=\"utf-8\", sep=\",\") # ajuste o sep se precisar (; ou \\t)\n", " df[\"source_file\"] = os.path.basename(folder)\n", " all_dfs.append(df)\n", " except Exception as e:\n", " print(f\"❌ Erro ao ler {file_path}: {e}\")\n", "\n", "# Junta tudo em um único DF\n", "if all_dfs:\n", " combined_df = pd.concat(all_dfs, ignore_index=True)\n", " print(f\"✅ DataFrame final tem {combined_df.shape[0]} linhas e {combined_df.shape[1]} colunas.\")\n", "else:\n", " print(\"⚠️ Nenhum CSV válido encontrado.\")\n" ] }, { "cell_type": "code", "execution_count": 12, "id": "f51f7fc1", "metadata": {}, "outputs": [], "source": [ "combined_df2 = combined_df[['PDV', 'SKU','source_file']]\n" ] }, { "cell_type": "code", "execution_count": 13, "id": "946d1515", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\joao.herculano\\AppData\\Local\\Temp\\ipykernel_7172\\3795880551.py:1: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " combined_df2['source_file'] = combined_df2['source_file'].str.replace('draft ','')\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", "
PDVSKUsource_file
023701490142
123702490142
223705490142
323706490142
423703490142
\n", "
" ], "text/plain": [ " PDV SKU source_file\n", "0 23701 49014 2\n", "1 23702 49014 2\n", "2 23705 49014 2\n", "3 23706 49014 2\n", "4 23703 49014 2" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "combined_df2['source_file'] = combined_df2['source_file'].str.replace('draft ','')\n", "combined_df2.head()" ] }, { "cell_type": "code", "execution_count": 14, "id": "d7353ba8", "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", "
PDVSKUmes_data
023701490142
123702490142
223705490142
323706490142
423703490142
\n", "
" ], "text/plain": [ " PDV SKU mes_data\n", "0 23701 49014 2\n", "1 23702 49014 2\n", "2 23705 49014 2\n", "3 23706 49014 2\n", "4 23703 49014 2" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "combined_df2 = combined_df2.rename(columns={'source_file':'mes_data'})\n", "combined_df2.head()" ] }, { "cell_type": "code", "execution_count": 15, "id": "8beb5fbc", "metadata": {}, "outputs": [], "source": [ "draft_06_frente = pd.read_csv(r\"C:\\Users\\joao.herculano\\GRUPO GINSENG\\Assistência Suprimentos - 2025\\CODIGOS\\estudo estoque desativado\\draft 06 em diante 20251001.csv\",sep=';')" ] }, { "cell_type": "code", "execution_count": 16, "id": "54d71498", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['id', 'loja_id', 'code', 'description', 'launch', 'deactivation',\n", " 'thirdtolastcyclesales', 'secondtolastcyclesales', 'lastcyclesales',\n", " 'currentcyclesales', 'nextcycleprojection',\n", " 'secondtonextcycleprojection', 'stock_actual', 'stock_intransit',\n", " 'purchasesuggestion', 'smartpurchase_purchasesuggestioncycle',\n", " 'smartpurchase_nextcyclepurchasesuggestion', 'pendingorder',\n", " 'salescurve', 'promotions_description', 'promotions_discountpercent',\n", " 'pricesellin', 'businessunit', 'codcategory',\n", " 'criticalitem_dtprovidedregularization', 'criticalitem_blockedwallet',\n", " 'criticalitem_iscritical', 'codsubcategory', 'isproductdeactivated',\n", " 'brandgroupcode', 'dayswithoutsales', 'coveragedays', 'hascoverage',\n", " 'TRIAL949', 'data'],\n", " dtype='object')" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "draft_06_frente.columns" ] }, { "cell_type": "code", "execution_count": 17, "id": "1e9492e1", "metadata": {}, "outputs": [], "source": [ "draft_06_frente = draft_06_frente[['loja_id', 'code','data']]" ] }, { "cell_type": "code", "execution_count": 18, "id": "81d03059", "metadata": {}, "outputs": [], "source": [ "draft_06_frente['mes_data'] = draft_06_frente['data'].str[6]" ] }, { "cell_type": "code", "execution_count": 19, "id": "1ec3e38b", "metadata": {}, "outputs": [], "source": [ "draft_06_frente = draft_06_frente.rename(columns={'loja_id':'PDV','code':'SKU'})" ] }, { "cell_type": "code", "execution_count": 20, "id": "37f327fb", "metadata": {}, "outputs": [], "source": [ "draft_06_frente = draft_06_frente.drop(columns='data')" ] }, { "cell_type": "code", "execution_count": 21, "id": "a72422ab", "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", "
PDVSKUmes_data
012824590356
112824589686
212824590316
321647766646
421647539336
\n", "
" ], "text/plain": [ " PDV SKU mes_data\n", "0 12824 59035 6\n", "1 12824 58968 6\n", "2 12824 59031 6\n", "3 21647 76664 6\n", "4 21647 53933 6" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "draft_06_frente.head()" ] }, { "cell_type": "code", "execution_count": 22, "id": "15571e09", "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", "
PDVSKUmes_data
023701490142
123702490142
223705490142
323706490142
423703490142
\n", "
" ], "text/plain": [ " PDV SKU mes_data\n", "0 23701 49014 2\n", "1 23702 49014 2\n", "2 23705 49014 2\n", "3 23706 49014 2\n", "4 23703 49014 2" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "drafts = [combined_df2,draft_06_frente]\n", "df_draft = pd.concat(drafts)\n", "df_draft.head()" ] }, { "cell_type": "code", "execution_count": 23, "id": "1098e037", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "mes_data\n", "9 150950\n", "7 147723\n", "8 145559\n", "6 130690\n", "5 114464\n", "3 111840\n", "2 111546\n", "4 109997\n", "Name: count, dtype: int64" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_draft['mes_data'].value_counts()" ] }, { "cell_type": "code", "execution_count": 24, "id": "aaeedaec", "metadata": {}, "outputs": [], "source": [ "df_draft = df_draft.rename(columns={'SKU':'SKU_DRAFT'})" ] }, { "cell_type": "code", "execution_count": 25, "id": "0ee0b85e", "metadata": {}, "outputs": [], "source": [ "df_draft['mes_data'] = df_draft['mes_data'].astype('Int64')" ] }, { "cell_type": "code", "execution_count": 26, "id": "71d320e8", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "PDV int64\n", "SKU_DRAFT int64\n", "mes_data Int64\n", "dtype: object" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_draft.dtypes" ] }, { "cell_type": "code", "execution_count": 27, "id": "b20879c6", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "137565 2\n", "138944 2\n", "138945 2\n", "138946 2\n", "138948 2\n", " ..\n", "3890084 8\n", "3890085 8\n", "3890086 8\n", "3890090 8\n", "3890091 8\n", "Name: mes_data, Length: 852738, dtype: object" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_estoque['mes_data']" ] }, { "cell_type": "code", "execution_count": 28, "id": "889e57d7", "metadata": {}, "outputs": [], "source": [ "df_estoque['mes_data'] = df_estoque['mes_data'].astype('Int64')" ] }, { "cell_type": "code", "execution_count": 29, "id": "0040c987", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
PDVSKU_DRAFTmes_data
123702490142
\n", "
" ], "text/plain": [ " PDV SKU_DRAFT mes_data\n", "1 23702 49014 2" ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_draft[(df_draft['PDV']==23702)&(df_draft['SKU_DRAFT']==49014)&(df_draft['mes_data']==2)]" ] }, { "cell_type": "code", "execution_count": 30, "id": "d8547d86", "metadata": {}, "outputs": [], "source": [ "df_draft['SKU_DRAFT'] = df_draft['SKU_DRAFT'].astype(str).str.replace('.0', '', regex=False)\n", "\n", "df_draft['SKU_DRAFT'] = df_draft['SKU_DRAFT'] .astype('Int64')" ] }, { "cell_type": "code", "execution_count": 31, "id": "3b02dd27", "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", "
SKUSKU_PARADESCRICAOCATEGORIACLASSEFASES PRODUTOLANCAMENTODESATIVACAOPDVESTOQUE ATUAL...PEDIDO PENDENTECOBERTURA ALVOESTOQUE DE SEGURANCADDV PREVISTOCOBERTURA ATUALCOBERTURA ATUAL + TRANSITOCOBERTURA PROJETADAdata_estoqueORIGEMmes_data
40800349014-ACCORDES CREM DES HID CPO 200ml V2CUIDADOS COM A PELEBMaduro202208.0NaN2370216.0...0.024.02.00.07228.0228.0228.02025-02-26NaN2
\n", "

1 rows × 21 columns

\n", "
" ], "text/plain": [ " SKU SKU_PARA DESCRICAO \\\n", "408003 49014 - ACCORDES CREM DES HID CPO 200ml V2 \n", "\n", " CATEGORIA CLASSE FASES PRODUTO LANCAMENTO DESATIVACAO \\\n", "408003 CUIDADOS COM A PELE B Maduro 202208.0 NaN \n", "\n", " PDV ESTOQUE ATUAL ... PEDIDO PENDENTE COBERTURA ALVO \\\n", "408003 23702 16.0 ... 0.0 24.0 \n", "\n", " ESTOQUE DE SEGURANCA DDV PREVISTO COBERTURA ATUAL \\\n", "408003 2.0 0.07 228.0 \n", "\n", " COBERTURA ATUAL + TRANSITO COBERTURA PROJETADA data_estoque ORIGEM \\\n", "408003 228.0 228.0 2025-02-26 NaN \n", "\n", " mes_data \n", "408003 2 \n", "\n", "[1 rows x 21 columns]" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_estoque[(df_estoque['PDV']==23702)&(df_estoque['SKU']==49014)&(df_estoque['mes_data']==2)]" ] }, { "cell_type": "code", "execution_count": 32, "id": "c6441324", "metadata": {}, "outputs": [], "source": [ "df_final = pd.merge(df_estoque,df_draft,left_on=['PDV','SKU','mes_data'], right_on=['PDV','SKU_DRAFT','mes_data'],how='left')\n", "\n" ] }, { "cell_type": "code", "execution_count": 33, "id": "76fe1b4d", "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", "
SKUSKU_PARADESCRICAOCATEGORIACLASSEFASES PRODUTOLANCAMENTODESATIVACAOPDVESTOQUE ATUAL...COBERTURA ALVOESTOQUE DE SEGURANCADDV PREVISTOCOBERTURA ATUALCOBERTURA ATUAL + TRANSITOCOBERTURA PROJETADAdata_estoqueORIGEMmes_dataSKU_DRAFT
088146-MAKE B BAS LIQ ONE 220Q 30gMAQUIAGEMEMaduro202514.0NaN212771.0...NaNNaNNaNNaNNaNNaN2025-02-26NaN2<NA>
8787201-CBEM SAB BARR DUO FEIR MELAN/M VER 2x80gSABONETE CORPOEDescontinuadoNaNNaN128182.0...NaNNaNNaNNaNNaNNaN2025-02-26NaN2<NA>
8887201-CBEM SAB BARR DUO FEIR MELAN/M VER 2x80gSABONETE CORPOEDescontinuadoNaNNaN128242.0...NaNNaNNaNNaNNaNNaN2025-02-26NaN2<NA>
8987201-CBEM SAB BARR DUO FEIR MELAN/M VER 2x80gSABONETE CORPOEDescontinuadoNaNNaN210681.0...NaNNaNNaNNaNNaNNaN2025-02-26NaN2<NA>
9087201-CBEM SAB BARR DUO FEIR MELAN/M VER 2x80gSABONETE CORPOEDescontinuadoNaNNaN213812.0...NaNNaNNaNNaNNaNNaN2025-02-26NaN2<NA>
\n", "

5 rows × 22 columns

\n", "
" ], "text/plain": [ " SKU SKU_PARA DESCRICAO CATEGORIA \\\n", "0 88146 - MAKE B BAS LIQ ONE 220Q 30g MAQUIAGEM \n", "87 87201 - CBEM SAB BARR DUO FEIR MELAN/M VER 2x80g SABONETE CORPO \n", "88 87201 - CBEM SAB BARR DUO FEIR MELAN/M VER 2x80g SABONETE CORPO \n", "89 87201 - CBEM SAB BARR DUO FEIR MELAN/M VER 2x80g SABONETE CORPO \n", "90 87201 - CBEM SAB BARR DUO FEIR MELAN/M VER 2x80g SABONETE CORPO \n", "\n", " CLASSE FASES PRODUTO LANCAMENTO DESATIVACAO PDV ESTOQUE ATUAL ... \\\n", "0 E Maduro 202514.0 NaN 21277 1.0 ... \n", "87 E Descontinuado NaN NaN 12818 2.0 ... \n", "88 E Descontinuado NaN NaN 12824 2.0 ... \n", "89 E Descontinuado NaN NaN 21068 1.0 ... \n", "90 E Descontinuado NaN NaN 21381 2.0 ... \n", "\n", " COBERTURA ALVO ESTOQUE DE SEGURANCA DDV PREVISTO COBERTURA ATUAL \\\n", "0 NaN NaN NaN NaN \n", "87 NaN NaN NaN NaN \n", "88 NaN NaN NaN NaN \n", "89 NaN NaN NaN NaN \n", "90 NaN NaN NaN NaN \n", "\n", " COBERTURA ATUAL + TRANSITO COBERTURA PROJETADA data_estoque ORIGEM \\\n", "0 NaN NaN 2025-02-26 NaN \n", "87 NaN NaN 2025-02-26 NaN \n", "88 NaN NaN 2025-02-26 NaN \n", "89 NaN NaN 2025-02-26 NaN \n", "90 NaN NaN 2025-02-26 NaN \n", "\n", " mes_data SKU_DRAFT \n", "0 2 \n", "87 2 \n", "88 2 \n", "89 2 \n", "90 2 \n", "\n", "[5 rows x 22 columns]" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_final_desativado = df_final[df_final['SKU_DRAFT'].isna()]\n", "\n", "df_final_desativado.head()" ] }, { "cell_type": "code", "execution_count": 34, "id": "a00988e1", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(228121, 22)" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_final_desativado.shape" ] }, { "cell_type": "code", "execution_count": 35, "id": "56723a8c", "metadata": {}, "outputs": [], "source": [ "df_final_desativado.head(10000).to_clipboard()" ] }, { "cell_type": "code", "execution_count": 36, "id": "5c77ceda", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "mes_data\n", "9 150950\n", "7 147723\n", "8 145559\n", "6 130690\n", "5 114464\n", "3 111840\n", "2 111546\n", "4 109997\n", "Name: count, dtype: Int64" ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_draft['mes_data'].value_counts()" ] }, { "cell_type": "code", "execution_count": 37, "id": "12b953c7", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "mes_data\n", "9 124582\n", "8 120773\n", "7 110117\n", "6 108662\n", "4 99104\n", "5 98746\n", "3 97120\n", "2 93634\n", "Name: count, dtype: Int64" ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_final['mes_data'].value_counts()" ] }, { "cell_type": "code", "execution_count": 46, "id": "f1639562", "metadata": {}, "outputs": [], "source": [ "df_final.to_excel(r'C:\\Users\\joao.herculano\\Documents\\df_final.xlsx',index=False)" ] }, { "cell_type": "code", "execution_count": 47, "id": "6ec55259", "metadata": {}, "outputs": [], "source": [ "df_final.to_clipboard()" ] }, { "cell_type": "code", "execution_count": null, "id": "7d04017a", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.2" } }, "nbformat": 4, "nbformat_minor": 5 }