{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "ab75ca0c-004e-4350-a9e7-59972b2efff1", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": 2, "id": "b107f3b2-57f3-4439-883b-146f22ea5e07", "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", "
skunational_invlead_timein_transit_qtyforecast_3_monthforecast_6_monthforecast_9_monthsales_1_monthsales_3_monthsales_6_month...pieces_past_dueperf_6_month_avgperf_12_month_avglocal_bo_qtydeck_riskoe_constraintppap_riskstop_auto_buyrev_stopwent_on_backorder
01888279117NaN00000015...0-99.00-99.000NoNoYesYesNoNo
1187055772.00000000...00.500.280YesNoNoYesNoNo
2147548125815.010107718446132256...00.540.700NoNoNoYesNoNo
31758220462.00000126...00.750.900YesNoNoYesNoNo
\n", "

4 rows × 23 columns

\n", "
" ], "text/plain": [ " sku national_inv lead_time in_transit_qty forecast_3_month \\\n", "0 1888279 117 NaN 0 0 \n", "1 1870557 7 2.0 0 0 \n", "2 1475481 258 15.0 10 10 \n", "3 1758220 46 2.0 0 0 \n", "\n", " forecast_6_month forecast_9_month sales_1_month sales_3_month \\\n", "0 0 0 0 0 \n", "1 0 0 0 0 \n", "2 77 184 46 132 \n", "3 0 0 1 2 \n", "\n", " sales_6_month ... pieces_past_due perf_6_month_avg perf_12_month_avg \\\n", "0 15 ... 0 -99.00 -99.00 \n", "1 0 ... 0 0.50 0.28 \n", "2 256 ... 0 0.54 0.70 \n", "3 6 ... 0 0.75 0.90 \n", "\n", " local_bo_qty deck_risk oe_constraint ppap_risk stop_auto_buy rev_stop \\\n", "0 0 No No Yes Yes No \n", "1 0 Yes No No Yes No \n", "2 0 No No No Yes No \n", "3 0 Yes No No Yes No \n", "\n", " went_on_backorder \n", "0 No \n", "1 No \n", "2 No \n", "3 No \n", "\n", "[4 rows x 23 columns]" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "orders = pd.read_csv('BackOrders.csv')\n", "\n", "orders.head(4)" ] }, { "cell_type": "code", "execution_count": 5, "id": "a0ce2f36-0875-432c-8e9c-2a5dec9f908d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(61589, 23)" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "orders.shape" ] }, { "cell_type": "code", "execution_count": 3, "id": "7cada021-5822-4754-9195-2af60b28db30", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 61589 entries, 0 to 61588\n", "Data columns (total 23 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 sku 61589 non-null int64 \n", " 1 national_inv 61589 non-null int64 \n", " 2 lead_time 58186 non-null float64\n", " 3 in_transit_qty 61589 non-null int64 \n", " 4 forecast_3_month 61589 non-null int64 \n", " 5 forecast_6_month 61589 non-null int64 \n", " 6 forecast_9_month 61589 non-null int64 \n", " 7 sales_1_month 61589 non-null int64 \n", " 8 sales_3_month 61589 non-null int64 \n", " 9 sales_6_month 61589 non-null int64 \n", " 10 sales_9_month 61589 non-null int64 \n", " 11 min_bank 61589 non-null int64 \n", " 12 potential_issue 61589 non-null object \n", " 13 pieces_past_due 61589 non-null int64 \n", " 14 perf_6_month_avg 61589 non-null float64\n", " 15 perf_12_month_avg 61589 non-null float64\n", " 16 local_bo_qty 61589 non-null int64 \n", " 17 deck_risk 61589 non-null object \n", " 18 oe_constraint 61589 non-null object \n", " 19 ppap_risk 61589 non-null object \n", " 20 stop_auto_buy 61589 non-null object \n", " 21 rev_stop 61589 non-null object \n", " 22 went_on_backorder 61589 non-null object \n", "dtypes: float64(3), int64(13), object(7)\n", "memory usage: 10.8+ MB\n" ] } ], "source": [ "orders.info()" ] }, { "cell_type": "code", "execution_count": 4, "id": "b6c8cc41-49bf-4e08-9f4f-f89a87616da7", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "sku 0\n", "national_inv 0\n", "lead_time 3403\n", "in_transit_qty 0\n", "forecast_3_month 0\n", "forecast_6_month 0\n", "forecast_9_month 0\n", "sales_1_month 0\n", "sales_3_month 0\n", "sales_6_month 0\n", "sales_9_month 0\n", "min_bank 0\n", "potential_issue 0\n", "pieces_past_due 0\n", "perf_6_month_avg 0\n", "perf_12_month_avg 0\n", "local_bo_qty 0\n", "deck_risk 0\n", "oe_constraint 0\n", "ppap_risk 0\n", "stop_auto_buy 0\n", "rev_stop 0\n", "went_on_backorder 0\n", "dtype: int64" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "orders.isnull().sum(axis=0)" ] }, { "cell_type": "code", "execution_count": 7, "id": "7e380cde-5dce-4d7d-a70d-796e98c9e79f", "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", "
skunational_invlead_timein_transit_qtyforecast_3_monthforecast_6_monthforecast_9_monthsales_1_monthsales_3_monthsales_6_monthsales_9_monthmin_bankpieces_past_dueperf_6_month_avgperf_12_month_avglocal_bo_qty
count6.158900e+0461589.00000058186.00000061589.0000006.158900e+046.158900e+046.158900e+0461589.00000061589.0000006.158900e+046.158900e+0461589.00000061589.00000061589.00000061589.00000061589.000000
mean2.037188e+06287.7218827.55961930.1928431.692728e+023.150413e+024.535760e+0244.742957150.7326312.835465e+024.196427e+0243.0872561.605400-6.264182-5.8636641.205361
std6.564178e+054233.9069316.498952792.8692535.286742e+039.774362e+031.420201e+041373.8058315224.9596498.872270e+031.269858e+04959.61413542.30922925.53790624.84451429.981155
min1.068628e+06-2999.0000000.0000000.0000000.000000e+000.000000e+000.000000e+000.0000000.0000000.000000e+000.000000e+000.0000000.000000-99.000000-99.0000000.000000
25%1.498574e+063.0000004.0000000.0000000.000000e+000.000000e+000.000000e+000.0000000.0000000.000000e+000.000000e+000.0000000.0000000.6200000.6400000.000000
50%1.898033e+0610.0000008.0000000.0000000.000000e+000.000000e+000.000000e+000.0000002.0000004.000000e+006.000000e+000.0000000.0000000.8200000.8000000.000000
75%2.314826e+0657.0000008.0000000.0000001.200000e+012.500000e+013.600000e+016.00000017.0000003.400000e+015.100000e+013.0000000.0000000.9600000.9500000.000000
max3.284895e+06673445.00000052.000000170976.0000001.126656e+062.094336e+063.062016e+06295197.000000934593.0000001.799099e+062.631590e+06192978.0000007392.0000001.0000001.0000002999.000000
\n", "
" ], "text/plain": [ " sku national_inv lead_time in_transit_qty \\\n", "count 6.158900e+04 61589.000000 58186.000000 61589.000000 \n", "mean 2.037188e+06 287.721882 7.559619 30.192843 \n", "std 6.564178e+05 4233.906931 6.498952 792.869253 \n", "min 1.068628e+06 -2999.000000 0.000000 0.000000 \n", "25% 1.498574e+06 3.000000 4.000000 0.000000 \n", "50% 1.898033e+06 10.000000 8.000000 0.000000 \n", "75% 2.314826e+06 57.000000 8.000000 0.000000 \n", "max 3.284895e+06 673445.000000 52.000000 170976.000000 \n", "\n", " forecast_3_month forecast_6_month forecast_9_month sales_1_month \\\n", "count 6.158900e+04 6.158900e+04 6.158900e+04 61589.000000 \n", "mean 1.692728e+02 3.150413e+02 4.535760e+02 44.742957 \n", "std 5.286742e+03 9.774362e+03 1.420201e+04 1373.805831 \n", "min 0.000000e+00 0.000000e+00 0.000000e+00 0.000000 \n", "25% 0.000000e+00 0.000000e+00 0.000000e+00 0.000000 \n", "50% 0.000000e+00 0.000000e+00 0.000000e+00 0.000000 \n", "75% 1.200000e+01 2.500000e+01 3.600000e+01 6.000000 \n", "max 1.126656e+06 2.094336e+06 3.062016e+06 295197.000000 \n", "\n", " sales_3_month sales_6_month sales_9_month min_bank \\\n", "count 61589.000000 6.158900e+04 6.158900e+04 61589.000000 \n", "mean 150.732631 2.835465e+02 4.196427e+02 43.087256 \n", "std 5224.959649 8.872270e+03 1.269858e+04 959.614135 \n", "min 0.000000 0.000000e+00 0.000000e+00 0.000000 \n", "25% 0.000000 0.000000e+00 0.000000e+00 0.000000 \n", "50% 2.000000 4.000000e+00 6.000000e+00 0.000000 \n", "75% 17.000000 3.400000e+01 5.100000e+01 3.000000 \n", "max 934593.000000 1.799099e+06 2.631590e+06 192978.000000 \n", "\n", " pieces_past_due perf_6_month_avg perf_12_month_avg local_bo_qty \n", "count 61589.000000 61589.000000 61589.000000 61589.000000 \n", "mean 1.605400 -6.264182 -5.863664 1.205361 \n", "std 42.309229 25.537906 24.844514 29.981155 \n", "min 0.000000 -99.000000 -99.000000 0.000000 \n", "25% 0.000000 0.620000 0.640000 0.000000 \n", "50% 0.000000 0.820000 0.800000 0.000000 \n", "75% 0.000000 0.960000 0.950000 0.000000 \n", "max 7392.000000 1.000000 1.000000 2999.000000 " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "orders.describe()" ] }, { "cell_type": "code", "execution_count": 11, "id": "f695df27-108b-487a-8cde-e8dbe95200ec", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "sku 0\n", "national_inv 0\n", "lead_time 0\n", "in_transit_qty 0\n", "forecast_3_month 0\n", "forecast_6_month 0\n", "forecast_9_month 0\n", "sales_1_month 0\n", "sales_3_month 0\n", "sales_6_month 0\n", "sales_9_month 0\n", "min_bank 0\n", "potential_issue 0\n", "pieces_past_due 0\n", "perf_6_month_avg 0\n", "perf_12_month_avg 0\n", "local_bo_qty 0\n", "deck_risk 0\n", "oe_constraint 0\n", "ppap_risk 0\n", "stop_auto_buy 0\n", "rev_stop 0\n", "went_on_backorder 0\n", "dtype: int64" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "orders[\"lead_time\"] = orders[\"lead_time\"].fillna(orders[\"lead_time\"].mean())\n", "orders.isnull().sum(axis=0)" ] }, { "cell_type": "code", "execution_count": null, "id": "14247ac6-0ede-45c8-8b2b-b65226ca3983", "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.12.5" } }, "nbformat": 4, "nbformat_minor": 5 }