DB_JOB/작업파일/_스크립트/_diag_buyeo_border2.py
hehihoho3 df16c98366 백업: DB수집 전체 스냅샷 (공공기관2 정리 전)
공공기관2 작업 중. _temp 몽타주(재생성가능)는 제외.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 18:15:40 +09:00

32 lines
1.4 KiB
Python

import sys, io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
import openpyxl
PKG = r'D:\01.프로젝트\DB수집\작업파일\_제출패키지_2026-06-03\프리랜서1\충청남도_부여군.xlsx'
ws = openpyxl.load_workbook(PKG).active
def anyb(cell):
b=cell.border
return any([b.left.style, b.right.style, b.top.style, b.bottom.style])
def allb(cell):
b=cell.border
return all([b.left.style, b.right.style, b.top.style, b.bottom.style])
# Use col K(11), L(12), G(7), B(2) as probes
for probe,name in [(2,'B'),(7,'G'),(11,'K'),(12,'L'),(14,'N'),(15,'O')]:
no=[r for r in range(3,ws.max_row+1) if not anyb(ws.cell(r,probe))]
def ranges(lst):
out=[]
for x in lst:
if out and x==out[-1][1]+1: out[-1][1]=x
else: out.append([x,x])
return [(a,b) for a,b in out]
print(f'col {name}: NO-border rows={len(no)} ranges={ranges(no)[:12]}')
# detailed: full row border completeness using probe cells that should be thin all-sides (B,F..Q,L..)
# Compare a "good" row 233 set vs others: which rows differ from having thin on K
print('\n=== K(11) border per 40-row buckets (count with border) ===')
for start in range(3, ws.max_row+1, 40):
end=min(start+39, ws.max_row)
cnt=sum(1 for r in range(start,end+1) if anyb(ws.cell(r,11)))
print(f' rows {start}-{end}: K-bordered {cnt}/{end-start+1}')