공공기관2 작업 중. _temp 몽타주(재생성가능)는 제외. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
"""Apply changes to 정읍시 xlsx:
|
|
- 43 real boards: M (col13) = true bbs_total count
|
|
- 143 게시판-without-board: L (col12)='페이지', M=1
|
|
Only L and M touched. N/O/P/Q (KOGL/content) left as-is per user scope.
|
|
Backs up first."""
|
|
import openpyxl, json, io, re, shutil, os
|
|
|
|
SRC = '전북특별자치도_정읍시.xlsx'
|
|
BAK = '전북특별자치도_정읍시_backup_수량M_재분류전.xlsx'
|
|
if not os.path.exists(BAK):
|
|
shutil.copyfile(SRC, BAK)
|
|
|
|
data = json.load(io.open('_dump.json', encoding='utf-8'))
|
|
rep = json.load(io.open('_report.json', encoding='utf-8'))
|
|
cnt = {p['r']: p['count'] for p in rep['pages']}
|
|
|
|
wb = openpyxl.load_workbook(SRC)
|
|
ws = wb.active
|
|
COL_L, COL_M = 12, 13
|
|
|
|
n_fill = n_reclass = 0
|
|
for row in data:
|
|
r = row['r']
|
|
if row.get('L') != '게시판':
|
|
continue
|
|
c = cnt.get(r)
|
|
if c is not None: # real board -> set M=count
|
|
ws.cell(r, COL_M).value = c
|
|
n_fill += 1
|
|
else: # not a board -> 페이지, M=1
|
|
ws.cell(r, COL_L).value = '페이지'
|
|
ws.cell(r, COL_M).value = 1
|
|
n_reclass += 1
|
|
|
|
wb.save(SRC)
|
|
print('boards M filled:', n_fill, '| reclassified to 페이지:', n_reclass)
|