{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "cf0aaa83",
   "metadata": {},
   "source": [
    "# 02 분석 — AI 중요도, 도입 여부, 업종(KSIC 섹션)별 차이\n",
    "\n",
    "세 가지를 확인한다. ① 사업체들이 우리 경제의 성장·고용 변동에서 AI가 차지한다고 본 비중(D2), ② AI 기술을 이미 도입한 사업체와 그렇지 않은 사업체의 영향 인식 차이,\n",
    "③ KSIC 대분류(섹션)별 E4-1 2040년 점수 — 4장 산업 배분의 근거인 21개 업종 점수가 사업체의 실제 업종 코드로 다시 묶어도 같은 순위를 보이는지 점검한다."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "76f34236",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-07T19:49:50.022324Z",
     "iopub.status.busy": "2026-10-07T19:49:50.022324Z",
     "iopub.status.idle": "2026-10-07T19:49:50.368593Z",
     "shell.execute_reply": "2026-10-07T19:49:50.368593Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Python 3.12.10 · pandas 2.2.3 · numpy 2.4.6\n",
      "  원자료(비공개)     있음  data\\private\\AI수용도조사_원자료_n2297.xlsx\n",
      "  통계표(비공개)     있음  data\\private\\AI수용도조사_통계표_260417.xlsx\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "import numpy as np, pandas as pd\n",
    "import config as C\n",
    "import survey_raw as R\n",
    "pd.set_option(\"display.float_format\", lambda v: f\"{v:,.2f}\")\n",
    "C.setup()\n",
    "raw = pd.read_pickle(os.path.join(C.INTERIM, \"raw_slim.pkl\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "3f5cce13",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-07T19:49:50.370096Z",
     "iopub.status.busy": "2026-10-07T19:49:50.369596Z",
     "iopub.status.idle": "2026-10-07T19:49:50.379342Z",
     "shell.execute_reply": "2026-10-07T19:49:50.379342Z"
    },
    "tags": [
     "private-output"
    ]
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(비공개 설문 집계를 보여주는 셀이다. 공개 화면에서는 출력을 생략했다. 자료를 가진 경우 직접 실행하면 표시된다.)"
     ]
    }
   ],
   "source": [
    "s = R.summary(raw)\n",
    "pd.Series(s).to_csv(os.path.join(C.OUTPUT, \"summary.csv\"), encoding=\"utf-8-sig\")\n",
    "pd.Series(s).to_frame(\"값\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "3e90b16c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-07T19:49:50.380345Z",
     "iopub.status.busy": "2026-10-07T19:49:50.380345Z",
     "iopub.status.idle": "2026-10-07T19:49:50.385903Z",
     "shell.execute_reply": "2026-10-07T19:49:50.385903Z"
    },
    "tags": [
     "private-output"
    ]
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(비공개 설문 집계를 보여주는 셀이다. 공개 화면에서는 출력을 생략했다. 자료를 가진 경우 직접 실행하면 표시된다.)"
     ]
    }
   ],
   "source": [
    "ad = R.by_adoption(raw)\n",
    "ad.to_csv(os.path.join(C.OUTPUT, \"by_adoption.csv\"), encoding=\"utf-8-sig\")\n",
    "ad"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "a46bb467",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-07T19:49:50.386406Z",
     "iopub.status.busy": "2026-10-07T19:49:50.386406Z",
     "iopub.status.idle": "2026-10-07T19:49:50.391734Z",
     "shell.execute_reply": "2026-10-07T19:49:50.391734Z"
    },
    "tags": [
     "private-output"
    ]
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(비공개 설문 집계를 보여주는 셀이다. 공개 화면에서는 출력을 생략했다. 자료를 가진 경우 직접 실행하면 표시된다.)"
     ]
    }
   ],
   "source": [
    "sec = R.by_section(raw)\n",
    "sec.to_csv(os.path.join(C.OUTPUT, \"by_section.csv\"), encoding=\"utf-8-sig\")\n",
    "sec"
   ]
  }
 ],
 "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.12.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
