[email protected]
commited on
Commit
·
1defa39
1
Parent(s):
cff99be
Cleaning minor lines and unused variables
Browse files
notebook/analyze_Realdata.ipynb
CHANGED
|
@@ -774,14 +774,11 @@
|
|
| 774 |
"\n",
|
| 775 |
"plt.figure(figsize=(10, 6))\n",
|
| 776 |
"\n",
|
| 777 |
-
"# 날짜 기준으로 집계\n",
|
| 778 |
"grouped = df_merged.groupby('Basic finish date').sum()\n",
|
| 779 |
"\n",
|
| 780 |
-
"# 선 그래프 그리기\n",
|
| 781 |
"plt.plot(grouped.index, grouped['required_humanizer'], label='Humanizer')\n",
|
| 782 |
"plt.plot(grouped.index, grouped['required_unicef'], label='UNICEF')\n",
|
| 783 |
"\n",
|
| 784 |
-
"# 축 이름, 범례, 제목 등\n",
|
| 785 |
"plt.xlabel('Basic finish date')\n",
|
| 786 |
"plt.ylabel('Required labor')\n",
|
| 787 |
"plt.title('Labor Requirement Over Time')\n",
|
|
|
|
| 774 |
"\n",
|
| 775 |
"plt.figure(figsize=(10, 6))\n",
|
| 776 |
"\n",
|
|
|
|
| 777 |
"grouped = df_merged.groupby('Basic finish date').sum()\n",
|
| 778 |
"\n",
|
|
|
|
| 779 |
"plt.plot(grouped.index, grouped['required_humanizer'], label='Humanizer')\n",
|
| 780 |
"plt.plot(grouped.index, grouped['required_unicef'], label='UNICEF')\n",
|
| 781 |
"\n",
|
|
|
|
| 782 |
"plt.xlabel('Basic finish date')\n",
|
| 783 |
"plt.ylabel('Required labor')\n",
|
| 784 |
"plt.title('Labor Requirement Over Time')\n",
|
notebook/executed_analyze_Realdata.ipynb
DELETED
|
@@ -1,458 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"cells": [
|
| 3 |
-
{
|
| 4 |
-
"cell_type": "code",
|
| 5 |
-
"execution_count": 1,
|
| 6 |
-
"metadata": {
|
| 7 |
-
"execution": {
|
| 8 |
-
"iopub.execute_input": "2025-07-02T04:12:14.945798Z",
|
| 9 |
-
"iopub.status.busy": "2025-07-02T04:12:14.945621Z",
|
| 10 |
-
"iopub.status.idle": "2025-07-02T04:12:15.606764Z",
|
| 11 |
-
"shell.execute_reply": "2025-07-02T04:12:15.606337Z"
|
| 12 |
-
}
|
| 13 |
-
},
|
| 14 |
-
"outputs": [
|
| 15 |
-
{
|
| 16 |
-
"data": {
|
| 17 |
-
"text/html": [
|
| 18 |
-
"<div>\n",
|
| 19 |
-
"<style scoped>\n",
|
| 20 |
-
" .dataframe tbody tr th:only-of-type {\n",
|
| 21 |
-
" vertical-align: middle;\n",
|
| 22 |
-
" }\n",
|
| 23 |
-
"\n",
|
| 24 |
-
" .dataframe tbody tr th {\n",
|
| 25 |
-
" vertical-align: top;\n",
|
| 26 |
-
" }\n",
|
| 27 |
-
"\n",
|
| 28 |
-
" .dataframe thead th {\n",
|
| 29 |
-
" text-align: right;\n",
|
| 30 |
-
" }\n",
|
| 31 |
-
"</style>\n",
|
| 32 |
-
"<table border=\"1\" class=\"dataframe\">\n",
|
| 33 |
-
" <thead>\n",
|
| 34 |
-
" <tr style=\"text-align: right;\">\n",
|
| 35 |
-
" <th></th>\n",
|
| 36 |
-
" <th>Order</th>\n",
|
| 37 |
-
" <th>Material Number</th>\n",
|
| 38 |
-
" <th>Material description</th>\n",
|
| 39 |
-
" <th>Order quantity (GMEIN)</th>\n",
|
| 40 |
-
" <th>Basic start date</th>\n",
|
| 41 |
-
" <th>Basic finish date</th>\n",
|
| 42 |
-
" <th>System Status</th>\n",
|
| 43 |
-
" </tr>\n",
|
| 44 |
-
" </thead>\n",
|
| 45 |
-
" <tbody>\n",
|
| 46 |
-
" <tr>\n",
|
| 47 |
-
" <th>0</th>\n",
|
| 48 |
-
" <td>100033364</td>\n",
|
| 49 |
-
" <td>S9992431</td>\n",
|
| 50 |
-
" <td>SUB 1/8 NBK, Clinic, Module 1, Medicines</td>\n",
|
| 51 |
-
" <td>14</td>\n",
|
| 52 |
-
" <td>2025-03-03</td>\n",
|
| 53 |
-
" <td>2025-03-07</td>\n",
|
| 54 |
-
" <td>REL PRC BCRQ MACM SETC</td>\n",
|
| 55 |
-
" </tr>\n",
|
| 56 |
-
" <tr>\n",
|
| 57 |
-
" <th>1</th>\n",
|
| 58 |
-
" <td>100034881</td>\n",
|
| 59 |
-
" <td>S9991123</td>\n",
|
| 60 |
-
" <td>SUB 3/5 f.S9901026 IEHK2017 part 1</td>\n",
|
| 61 |
-
" <td>58</td>\n",
|
| 62 |
-
" <td>2025-03-17</td>\n",
|
| 63 |
-
" <td>2025-03-21</td>\n",
|
| 64 |
-
" <td>REL PRC BCRQ MACM SETC</td>\n",
|
| 65 |
-
" </tr>\n",
|
| 66 |
-
" <tr>\n",
|
| 67 |
-
" <th>2</th>\n",
|
| 68 |
-
" <td>100035124</td>\n",
|
| 69 |
-
" <td>S9992442</td>\n",
|
| 70 |
-
" <td>SUB 2/3 NBK, Clinic,Module 2,Consumables</td>\n",
|
| 71 |
-
" <td>5</td>\n",
|
| 72 |
-
" <td>2025-03-14</td>\n",
|
| 73 |
-
" <td>2025-03-21</td>\n",
|
| 74 |
-
" <td>REL PRC BCRQ MACM SETC</td>\n",
|
| 75 |
-
" </tr>\n",
|
| 76 |
-
" <tr>\n",
|
| 77 |
-
" <th>3</th>\n",
|
| 78 |
-
" <td>100034003</td>\n",
|
| 79 |
-
" <td>S9901042</td>\n",
|
| 80 |
-
" <td>IEHK 2024,Basic Equipment UNIT</td>\n",
|
| 81 |
-
" <td>800</td>\n",
|
| 82 |
-
" <td>2025-03-24</td>\n",
|
| 83 |
-
" <td>2025-03-28</td>\n",
|
| 84 |
-
" <td>REL PRC BCRQ MANC SETC</td>\n",
|
| 85 |
-
" </tr>\n",
|
| 86 |
-
" <tr>\n",
|
| 87 |
-
" <th>4</th>\n",
|
| 88 |
-
" <td>100034017</td>\n",
|
| 89 |
-
" <td>S9901042</td>\n",
|
| 90 |
-
" <td>IEHK 2024,Basic Equipment UNIT</td>\n",
|
| 91 |
-
" <td>800</td>\n",
|
| 92 |
-
" <td>2025-03-24</td>\n",
|
| 93 |
-
" <td>2025-03-28</td>\n",
|
| 94 |
-
" <td>REL PRC BCRQ MANC SETC</td>\n",
|
| 95 |
-
" </tr>\n",
|
| 96 |
-
" </tbody>\n",
|
| 97 |
-
"</table>\n",
|
| 98 |
-
"</div>"
|
| 99 |
-
],
|
| 100 |
-
"text/plain": [
|
| 101 |
-
" Order Material Number Material description \\\n",
|
| 102 |
-
"0 100033364 S9992431 SUB 1/8 NBK, Clinic, Module 1, Medicines \n",
|
| 103 |
-
"1 100034881 S9991123 SUB 3/5 f.S9901026 IEHK2017 part 1 \n",
|
| 104 |
-
"2 100035124 S9992442 SUB 2/3 NBK, Clinic,Module 2,Consumables \n",
|
| 105 |
-
"3 100034003 S9901042 IEHK 2024,Basic Equipment UNIT \n",
|
| 106 |
-
"4 100034017 S9901042 IEHK 2024,Basic Equipment UNIT \n",
|
| 107 |
-
"\n",
|
| 108 |
-
" Order quantity (GMEIN) Basic start date Basic finish date \\\n",
|
| 109 |
-
"0 14 2025-03-03 2025-03-07 \n",
|
| 110 |
-
"1 58 2025-03-17 2025-03-21 \n",
|
| 111 |
-
"2 5 2025-03-14 2025-03-21 \n",
|
| 112 |
-
"3 800 2025-03-24 2025-03-28 \n",
|
| 113 |
-
"4 800 2025-03-24 2025-03-28 \n",
|
| 114 |
-
"\n",
|
| 115 |
-
" System Status \n",
|
| 116 |
-
"0 REL PRC BCRQ MACM SETC \n",
|
| 117 |
-
"1 REL PRC BCRQ MACM SETC \n",
|
| 118 |
-
"2 REL PRC BCRQ MACM SETC \n",
|
| 119 |
-
"3 REL PRC BCRQ MANC SETC \n",
|
| 120 |
-
"4 REL PRC BCRQ MANC SETC "
|
| 121 |
-
]
|
| 122 |
-
},
|
| 123 |
-
"execution_count": 1,
|
| 124 |
-
"metadata": {},
|
| 125 |
-
"output_type": "execute_result"
|
| 126 |
-
}
|
| 127 |
-
],
|
| 128 |
-
"source": [
|
| 129 |
-
"#Use kernel 3.7.9 python\n",
|
| 130 |
-
"#!pip install pandas\n",
|
| 131 |
-
"import pandas as pd\n",
|
| 132 |
-
"demand_path = \"data/real_data_excel/converted_csv/COOIS_Released_Prod_Orders.csv\"\n",
|
| 133 |
-
"df = pd.read_csv(\"../\"+demand_path)\n",
|
| 134 |
-
"df.head()"
|
| 135 |
-
]
|
| 136 |
-
},
|
| 137 |
-
{
|
| 138 |
-
"cell_type": "code",
|
| 139 |
-
"execution_count": 2,
|
| 140 |
-
"metadata": {
|
| 141 |
-
"execution": {
|
| 142 |
-
"iopub.execute_input": "2025-07-02T04:12:15.638755Z",
|
| 143 |
-
"iopub.status.busy": "2025-07-02T04:12:15.638529Z",
|
| 144 |
-
"iopub.status.idle": "2025-07-02T04:12:15.642455Z",
|
| 145 |
-
"shell.execute_reply": "2025-07-02T04:12:15.642029Z"
|
| 146 |
-
}
|
| 147 |
-
},
|
| 148 |
-
"outputs": [
|
| 149 |
-
{
|
| 150 |
-
"data": {
|
| 151 |
-
"text/plain": [
|
| 152 |
-
"Order int64\n",
|
| 153 |
-
"Material Number object\n",
|
| 154 |
-
"Material description object\n",
|
| 155 |
-
"Order quantity (GMEIN) int64\n",
|
| 156 |
-
"Basic start date object\n",
|
| 157 |
-
"Basic finish date object\n",
|
| 158 |
-
"System Status object\n",
|
| 159 |
-
"dtype: object"
|
| 160 |
-
]
|
| 161 |
-
},
|
| 162 |
-
"execution_count": 2,
|
| 163 |
-
"metadata": {},
|
| 164 |
-
"output_type": "execute_result"
|
| 165 |
-
}
|
| 166 |
-
],
|
| 167 |
-
"source": [
|
| 168 |
-
"df.dtypes"
|
| 169 |
-
]
|
| 170 |
-
},
|
| 171 |
-
{
|
| 172 |
-
"cell_type": "code",
|
| 173 |
-
"execution_count": 3,
|
| 174 |
-
"metadata": {
|
| 175 |
-
"execution": {
|
| 176 |
-
"iopub.execute_input": "2025-07-02T04:12:15.644218Z",
|
| 177 |
-
"iopub.status.busy": "2025-07-02T04:12:15.644076Z",
|
| 178 |
-
"iopub.status.idle": "2025-07-02T04:12:15.647938Z",
|
| 179 |
-
"shell.execute_reply": "2025-07-02T04:12:15.647542Z"
|
| 180 |
-
}
|
| 181 |
-
},
|
| 182 |
-
"outputs": [
|
| 183 |
-
{
|
| 184 |
-
"name": "stdout",
|
| 185 |
-
"output_type": "stream",
|
| 186 |
-
"text": [
|
| 187 |
-
"현재 날짜 컬럼들의 샘플 데이터:\n",
|
| 188 |
-
"Basic start date 샘플: 0 2025-03-03\n",
|
| 189 |
-
"1 2025-03-17\n",
|
| 190 |
-
"2 2025-03-14\n",
|
| 191 |
-
"3 2025-03-24\n",
|
| 192 |
-
"4 2025-03-24\n",
|
| 193 |
-
"Name: Basic start date, dtype: object\n",
|
| 194 |
-
"Basic finish date 샘플: 0 2025-03-07\n",
|
| 195 |
-
"1 2025-03-21\n",
|
| 196 |
-
"2 2025-03-21\n",
|
| 197 |
-
"3 2025-03-28\n",
|
| 198 |
-
"4 2025-03-28\n",
|
| 199 |
-
"Name: Basic finish date, dtype: object\n",
|
| 200 |
-
"\n",
|
| 201 |
-
"현재 데이터 타입:\n",
|
| 202 |
-
"Basic start date: object\n",
|
| 203 |
-
"Basic finish date: object\n"
|
| 204 |
-
]
|
| 205 |
-
}
|
| 206 |
-
],
|
| 207 |
-
"source": [
|
| 208 |
-
"# Check current date columns\n",
|
| 209 |
-
"print(\"현재 날짜 컬럼들의 샘플 데이터:\")\n",
|
| 210 |
-
"print(\"Basic start date 샘플:\", df['Basic start date'].head())\n",
|
| 211 |
-
"print(\"Basic finish date 샘플:\", df['Basic finish date'].head())\n",
|
| 212 |
-
"print(\"\\n현재 데이터 타입:\")\n",
|
| 213 |
-
"print(\"Basic start date:\", df['Basic start date'].dtype)\n",
|
| 214 |
-
"print(\"Basic finish date:\", df['Basic finish date'].dtype)\n"
|
| 215 |
-
]
|
| 216 |
-
},
|
| 217 |
-
{
|
| 218 |
-
"cell_type": "code",
|
| 219 |
-
"execution_count": 4,
|
| 220 |
-
"metadata": {
|
| 221 |
-
"execution": {
|
| 222 |
-
"iopub.execute_input": "2025-07-02T04:12:15.650086Z",
|
| 223 |
-
"iopub.status.busy": "2025-07-02T04:12:15.649871Z",
|
| 224 |
-
"iopub.status.idle": "2025-07-02T04:12:15.661136Z",
|
| 225 |
-
"shell.execute_reply": "2025-07-02T04:12:15.660788Z"
|
| 226 |
-
}
|
| 227 |
-
},
|
| 228 |
-
"outputs": [
|
| 229 |
-
{
|
| 230 |
-
"name": "stdout",
|
| 231 |
-
"output_type": "stream",
|
| 232 |
-
"text": [
|
| 233 |
-
"🔄 날짜 컬럼을 datetime 형태로 변환 중...\n",
|
| 234 |
-
"✅ 날짜 변환 완료!\n",
|
| 235 |
-
"\n",
|
| 236 |
-
"변환 후 데이터 타입:\n",
|
| 237 |
-
"Basic start date: datetime64[ns]\n",
|
| 238 |
-
"Basic finish date: datetime64[ns]\n",
|
| 239 |
-
"\n",
|
| 240 |
-
"변환 후 샘플 데이터:\n",
|
| 241 |
-
" Basic start date Basic finish date\n",
|
| 242 |
-
"0 2025-03-03 2025-03-07\n",
|
| 243 |
-
"1 2025-03-17 2025-03-21\n",
|
| 244 |
-
"2 2025-03-14 2025-03-21\n",
|
| 245 |
-
"3 2025-03-24 2025-03-28\n",
|
| 246 |
-
"4 2025-03-24 2025-03-28\n"
|
| 247 |
-
]
|
| 248 |
-
}
|
| 249 |
-
],
|
| 250 |
-
"source": [
|
| 251 |
-
"# Convert date columns to datetime\n",
|
| 252 |
-
"print(\"🔄 날짜 컬럼을 datetime 형태로 변환 중...\")\n",
|
| 253 |
-
"\n",
|
| 254 |
-
"# Convert Basic start date and Basic finish date to datetime\n",
|
| 255 |
-
"df['Basic start date'] = pd.to_datetime(df['Basic start date'], format='%Y-%m-%d', errors='coerce')\n",
|
| 256 |
-
"df['Basic finish date'] = pd.to_datetime(df['Basic finish date'], format='%Y-%m-%d', errors='coerce')\n",
|
| 257 |
-
"\n",
|
| 258 |
-
"print(\"✅ 날짜 변환 완료!\")\n",
|
| 259 |
-
"print(\"\\n변환 후 데이터 타입:\")\n",
|
| 260 |
-
"print(\"Basic start date:\", df['Basic start date'].dtype)\n",
|
| 261 |
-
"print(\"Basic finish date:\", df['Basic finish date'].dtype)\n",
|
| 262 |
-
"\n",
|
| 263 |
-
"print(\"\\n변환 후 샘플 데이터:\")\n",
|
| 264 |
-
"print(df[['Basic start date', 'Basic finish date']].head())\n"
|
| 265 |
-
]
|
| 266 |
-
},
|
| 267 |
-
{
|
| 268 |
-
"cell_type": "code",
|
| 269 |
-
"execution_count": 5,
|
| 270 |
-
"metadata": {
|
| 271 |
-
"execution": {
|
| 272 |
-
"iopub.execute_input": "2025-07-02T04:12:15.662982Z",
|
| 273 |
-
"iopub.status.busy": "2025-07-02T04:12:15.662804Z",
|
| 274 |
-
"iopub.status.idle": "2025-07-02T04:12:15.669930Z",
|
| 275 |
-
"shell.execute_reply": "2025-07-02T04:12:15.669520Z"
|
| 276 |
-
}
|
| 277 |
-
},
|
| 278 |
-
"outputs": [
|
| 279 |
-
{
|
| 280 |
-
"name": "stdout",
|
| 281 |
-
"output_type": "stream",
|
| 282 |
-
"text": [
|
| 283 |
-
"📁 Found 0 CSV files to process...\n",
|
| 284 |
-
"============================================================\n"
|
| 285 |
-
]
|
| 286 |
-
}
|
| 287 |
-
],
|
| 288 |
-
"source": [
|
| 289 |
-
"import os\n",
|
| 290 |
-
"import glob\n",
|
| 291 |
-
"\n",
|
| 292 |
-
"def convert_dates_in_csv_files(csv_directory):\n",
|
| 293 |
-
" \"\"\"\n",
|
| 294 |
-
" Convert date columns in all CSV files to datetime format\n",
|
| 295 |
-
" \n",
|
| 296 |
-
" Args:\n",
|
| 297 |
-
" csv_directory (str): Directory containing CSV files\n",
|
| 298 |
-
" \"\"\"\n",
|
| 299 |
-
" # Find all CSV files\n",
|
| 300 |
-
" csv_files = glob.glob(os.path.join(csv_directory, \"*.csv\"))\n",
|
| 301 |
-
" \n",
|
| 302 |
-
" # Date column patterns to look for\n",
|
| 303 |
-
" date_columns = [\n",
|
| 304 |
-
" 'Basic start date', 'Basic finish date', \n",
|
| 305 |
-
" 'PO Delivery Date', 'Valid From', 'Valid To',\n",
|
| 306 |
-
" 'Creation Date of Material', 'Pack date'\n",
|
| 307 |
-
" ]\n",
|
| 308 |
-
" \n",
|
| 309 |
-
" print(f\"📁 Found {len(csv_files)} CSV files to process...\")\n",
|
| 310 |
-
" print(\"=\" * 60)\n",
|
| 311 |
-
" \n",
|
| 312 |
-
" results = {}\n",
|
| 313 |
-
" \n",
|
| 314 |
-
" for csv_file in csv_files:\n",
|
| 315 |
-
" filename = os.path.basename(csv_file)\n",
|
| 316 |
-
" print(f\"\\n📄 Processing: {filename}\")\n",
|
| 317 |
-
" \n",
|
| 318 |
-
" try:\n",
|
| 319 |
-
" # Read CSV file\n",
|
| 320 |
-
" df = pd.read_csv(csv_file)\n",
|
| 321 |
-
" converted_columns = []\n",
|
| 322 |
-
" \n",
|
| 323 |
-
" # Check each potential date column\n",
|
| 324 |
-
" for date_col in date_columns:\n",
|
| 325 |
-
" if date_col in df.columns:\n",
|
| 326 |
-
" # Check if it's currently object type (string)\n",
|
| 327 |
-
" if df[date_col].dtype == 'object':\n",
|
| 328 |
-
" # Try to convert to datetime\n",
|
| 329 |
-
" original_samples = df[date_col].dropna().head(3).tolist()\n",
|
| 330 |
-
" df[date_col] = pd.to_datetime(df[date_col], errors='coerce')\n",
|
| 331 |
-
" converted_columns.append(date_col)\n",
|
| 332 |
-
" print(f\" ✅ Converted '{date_col}': {original_samples}\")\n",
|
| 333 |
-
" \n",
|
| 334 |
-
" if converted_columns:\n",
|
| 335 |
-
" # Save the updated CSV\n",
|
| 336 |
-
" df.to_csv(csv_file, index=False)\n",
|
| 337 |
-
" results[filename] = converted_columns\n",
|
| 338 |
-
" print(f\" 💾 Saved updated file with {len(converted_columns)} converted columns\")\n",
|
| 339 |
-
" else:\n",
|
| 340 |
-
" print(f\" ℹ️ No date columns found to convert\")\n",
|
| 341 |
-
" results[filename] = []\n",
|
| 342 |
-
" \n",
|
| 343 |
-
" except Exception as e:\n",
|
| 344 |
-
" print(f\" ❌ Error processing {filename}: {e}\")\n",
|
| 345 |
-
" results[filename] = f\"Error: {e}\"\n",
|
| 346 |
-
" \n",
|
| 347 |
-
" return results\n",
|
| 348 |
-
"\n",
|
| 349 |
-
"# Convert dates in all CSV files\n",
|
| 350 |
-
"csv_dir = \"../data/converted_csv\"\n",
|
| 351 |
-
"conversion_results = convert_dates_in_csv_files(csv_dir)\n"
|
| 352 |
-
]
|
| 353 |
-
},
|
| 354 |
-
{
|
| 355 |
-
"cell_type": "code",
|
| 356 |
-
"execution_count": 6,
|
| 357 |
-
"metadata": {
|
| 358 |
-
"execution": {
|
| 359 |
-
"iopub.execute_input": "2025-07-02T04:12:15.671770Z",
|
| 360 |
-
"iopub.status.busy": "2025-07-02T04:12:15.671585Z",
|
| 361 |
-
"iopub.status.idle": "2025-07-02T04:12:15.678103Z",
|
| 362 |
-
"shell.execute_reply": "2025-07-02T04:12:15.677635Z"
|
| 363 |
-
}
|
| 364 |
-
},
|
| 365 |
-
"outputs": [
|
| 366 |
-
{
|
| 367 |
-
"name": "stdout",
|
| 368 |
-
"output_type": "stream",
|
| 369 |
-
"text": [
|
| 370 |
-
"\n",
|
| 371 |
-
"============================================================\n",
|
| 372 |
-
"📊 DATE CONVERSION SUMMARY\n",
|
| 373 |
-
"============================================================\n",
|
| 374 |
-
"\n",
|
| 375 |
-
"🎯 RESULTS:\n",
|
| 376 |
-
" - Total files processed: 0\n",
|
| 377 |
-
" - Files with date conversions: 0\n",
|
| 378 |
-
" - Total date columns converted: 0\n",
|
| 379 |
-
"\n",
|
| 380 |
-
"🔍 VERIFICATION - Current dataframe:\n",
|
| 381 |
-
" - Basic start date type: datetime64[ns]\n",
|
| 382 |
-
" - Basic finish date type: datetime64[ns]\n",
|
| 383 |
-
"\n",
|
| 384 |
-
" Sample converted dates:\n",
|
| 385 |
-
" Order Basic start date Basic finish date\n",
|
| 386 |
-
"0 100033364 2025-03-03 2025-03-07\n",
|
| 387 |
-
"1 100034881 2025-03-17 2025-03-21\n",
|
| 388 |
-
"2 100035124 2025-03-14 2025-03-21\n",
|
| 389 |
-
"3 100034003 2025-03-24 2025-03-28\n",
|
| 390 |
-
"4 100034017 2025-03-24 2025-03-28\n"
|
| 391 |
-
]
|
| 392 |
-
}
|
| 393 |
-
],
|
| 394 |
-
"source": [
|
| 395 |
-
"# Summary of conversion results\n",
|
| 396 |
-
"print(\"\\n\" + \"=\" * 60)\n",
|
| 397 |
-
"print(\"📊 DATE CONVERSION SUMMARY\")\n",
|
| 398 |
-
"print(\"=\" * 60)\n",
|
| 399 |
-
"\n",
|
| 400 |
-
"total_files = len(conversion_results)\n",
|
| 401 |
-
"files_with_conversions = 0\n",
|
| 402 |
-
"total_columns_converted = 0\n",
|
| 403 |
-
"\n",
|
| 404 |
-
"for filename, columns in conversion_results.items():\n",
|
| 405 |
-
" if isinstance(columns, list) and len(columns) > 0:\n",
|
| 406 |
-
" files_with_conversions += 1\n",
|
| 407 |
-
" total_columns_converted += len(columns)\n",
|
| 408 |
-
" print(f\"✅ {filename}: {len(columns)} columns converted\")\n",
|
| 409 |
-
" for col in columns:\n",
|
| 410 |
-
" print(f\" - {col}\")\n",
|
| 411 |
-
" elif isinstance(columns, list):\n",
|
| 412 |
-
" print(f\"ℹ️ {filename}: No date columns found\")\n",
|
| 413 |
-
" else:\n",
|
| 414 |
-
" print(f\"❌ {filename}: {columns}\")\n",
|
| 415 |
-
"\n",
|
| 416 |
-
"print(f\"\\n🎯 RESULTS:\")\n",
|
| 417 |
-
"print(f\" - Total files processed: {total_files}\")\n",
|
| 418 |
-
"print(f\" - Files with date conversions: {files_with_conversions}\")\n",
|
| 419 |
-
"print(f\" - Total date columns converted: {total_columns_converted}\")\n",
|
| 420 |
-
"\n",
|
| 421 |
-
"# Test the conversion on our main dataframe\n",
|
| 422 |
-
"print(f\"\\n🔍 VERIFICATION - Current dataframe:\")\n",
|
| 423 |
-
"print(f\" - Basic start date type: {df['Basic start date'].dtype}\")\n",
|
| 424 |
-
"print(f\" - Basic finish date type: {df['Basic finish date'].dtype}\")\n",
|
| 425 |
-
"print(f\"\\n Sample converted dates:\")\n",
|
| 426 |
-
"print(df[['Order', 'Basic start date', 'Basic finish date']].head())\n"
|
| 427 |
-
]
|
| 428 |
-
},
|
| 429 |
-
{
|
| 430 |
-
"cell_type": "code",
|
| 431 |
-
"execution_count": null,
|
| 432 |
-
"metadata": {},
|
| 433 |
-
"outputs": [],
|
| 434 |
-
"source": []
|
| 435 |
-
}
|
| 436 |
-
],
|
| 437 |
-
"metadata": {
|
| 438 |
-
"kernelspec": {
|
| 439 |
-
"display_name": "Python 3",
|
| 440 |
-
"language": "python",
|
| 441 |
-
"name": "python3"
|
| 442 |
-
},
|
| 443 |
-
"language_info": {
|
| 444 |
-
"codemirror_mode": {
|
| 445 |
-
"name": "ipython",
|
| 446 |
-
"version": 3
|
| 447 |
-
},
|
| 448 |
-
"file_extension": ".py",
|
| 449 |
-
"mimetype": "text/x-python",
|
| 450 |
-
"name": "python",
|
| 451 |
-
"nbconvert_exporter": "python",
|
| 452 |
-
"pygments_lexer": "ipython3",
|
| 453 |
-
"version": "3.10.0"
|
| 454 |
-
}
|
| 455 |
-
},
|
| 456 |
-
"nbformat": 4,
|
| 457 |
-
"nbformat_minor": 2
|
| 458 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/models/optimizer_real.py
CHANGED
|
@@ -11,7 +11,7 @@ from ortools.linear_solver import pywraplp
|
|
| 11 |
from math import ceil
|
| 12 |
from src.config.constants import ShiftType, LineType, KitLevel
|
| 13 |
|
| 14 |
-
# ---- config import
|
| 15 |
from src.config.optimization_config import (
|
| 16 |
get_date_span, # DYNAMIC: Get date span dynamically
|
| 17 |
get_product_list, # DYNAMIC: list of products (e.g., ['A','B',...])
|
|
@@ -25,7 +25,6 @@ from src.config.optimization_config import (
|
|
| 25 |
MAX_HOUR_PER_PERSON_PER_DAY, # e.g., 14
|
| 26 |
get_max_hour_per_shift_per_person, # DYNAMIC: {1: hours, 2: hours, 3: hours}
|
| 27 |
get_max_parallel_workers, # DYNAMIC: {6: max_workers, 7: max_workers}
|
| 28 |
-
FIXED_STAFF_CONSTRAINT_MODE, # not used in fixed-team model (동시 투입이라 무의미)
|
| 29 |
get_team_requirements, # DYNAMIC: {emp_type: {product: team_size}} from Kits_Calculation.csv
|
| 30 |
get_payment_mode_config, # DYNAMIC: {shift: 'bulk'/'partial'} payment mode configuration
|
| 31 |
get_kit_line_match, # DYNAMIC: Get kit line match lazily
|
|
|
|
| 11 |
from math import ceil
|
| 12 |
from src.config.constants import ShiftType, LineType, KitLevel
|
| 13 |
|
| 14 |
+
# ---- config import ----
|
| 15 |
from src.config.optimization_config import (
|
| 16 |
get_date_span, # DYNAMIC: Get date span dynamically
|
| 17 |
get_product_list, # DYNAMIC: list of products (e.g., ['A','B',...])
|
|
|
|
| 25 |
MAX_HOUR_PER_PERSON_PER_DAY, # e.g., 14
|
| 26 |
get_max_hour_per_shift_per_person, # DYNAMIC: {1: hours, 2: hours, 3: hours}
|
| 27 |
get_max_parallel_workers, # DYNAMIC: {6: max_workers, 7: max_workers}
|
|
|
|
| 28 |
get_team_requirements, # DYNAMIC: {emp_type: {product: team_size}} from Kits_Calculation.csv
|
| 29 |
get_payment_mode_config, # DYNAMIC: {shift: 'bulk'/'partial'} payment mode configuration
|
| 30 |
get_kit_line_match, # DYNAMIC: Get kit line match lazily
|