Initial commit to new repository
This commit is contained in:
97
dist/AxCopilot/skills/xlsx-analyzer.skill.md
vendored
Normal file
97
dist/AxCopilot/skills/xlsx-analyzer.skill.md
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
---
|
||||
name: xlsx-analyzer
|
||||
label: Excel 데이터 분석
|
||||
description: Python을 사용하여 Excel/CSV 데이터를 분석하고 보고서를 생성합니다. 작업 폴더의 양식 파일을 자동 활용합니다.
|
||||
icon: \uE9F9
|
||||
requires: python
|
||||
tabs: cowork
|
||||
---
|
||||
|
||||
작업 폴더의 Excel 또는 CSV 데이터를 Python으로 분석하세요.
|
||||
|
||||
## 사전 준비
|
||||
필요한 패키지를 확인하고 설치하세요:
|
||||
```
|
||||
process_run: pip install pandas openpyxl
|
||||
```
|
||||
|
||||
## 양식 활용 (Excel 보고서 템플릿)
|
||||
작업 폴더에 Excel 양식 파일이 있으면 **반드시** 활용하세요:
|
||||
|
||||
1. **양식 탐색**: `folder_map`으로 작업 폴더에서 `.xlsx` 파일 목록 확인
|
||||
2. **양식 후보 판별**:
|
||||
- 파일명에 "양식", "template", "서식", "표준", "기본", "보고서양식" 포함
|
||||
- 또는 사용자가 "XX 양식에 맞춰서 작성해줘" 요청
|
||||
- 또는 사용자가 특정 .xlsx 파일명을 양식으로 지정
|
||||
3. **양식 구조 파악**: `document_read`로 양식의 시트 구조, 셀 레이아웃 확인
|
||||
4. **양식 기반 데이터 삽입**:
|
||||
```python
|
||||
from openpyxl import load_workbook
|
||||
wb = load_workbook('양식_보고서.xlsx')
|
||||
ws = wb.active
|
||||
# 양식의 서식(셀 병합, 테두리, 글꼴, 색상, 열 너비)이 그대로 유지됨
|
||||
# 데이터 영역에만 새 값 삽입
|
||||
ws['B3'] = '분석 결과값'
|
||||
wb.save('결과_보고서.xlsx')
|
||||
```
|
||||
5. **양식이 없으면**: 아래 기본 방식으로 분석 결과 생성
|
||||
|
||||
## 작업 절차
|
||||
1. **데이터 파일 탐색**: folder_map으로 작업 폴더에서 .xlsx, .csv 파일 확인
|
||||
2. **양식 확인**: 양식 .xlsx 파일이 있는지 확인 (데이터 파일과 양식 파일 구분)
|
||||
3. **데이터 읽기**: file_read 또는 document_read로 파일 구조 파악
|
||||
4. **분석 스크립트 작성**: file_write로 Python 분석 스크립트 생성
|
||||
5. **실행**: process_run으로 스크립트 실행
|
||||
6. **결과 보고**: 분석 결과를 사용자에게 정리하여 전달
|
||||
|
||||
## 분석 스크립트 템플릿
|
||||
```python
|
||||
import pandas as pd
|
||||
import json
|
||||
import os
|
||||
|
||||
df = pd.read_excel('data.xlsx') # 또는 pd.read_csv('data.csv')
|
||||
|
||||
report = {
|
||||
'shape': list(df.shape),
|
||||
'columns': list(df.columns),
|
||||
'dtypes': {col: str(dtype) for col, dtype in df.dtypes.items()},
|
||||
'missing': df.isnull().sum().to_dict(),
|
||||
'describe': df.describe().to_dict(),
|
||||
}
|
||||
|
||||
# 양식 파일로 결과 내보내기
|
||||
template_keywords = ['양식', 'template', '서식', '표준', '기본']
|
||||
template_file = None
|
||||
for f in os.listdir('.'):
|
||||
if f.endswith('.xlsx') and f != 'data.xlsx' and any(kw in f.lower() for kw in template_keywords):
|
||||
template_file = f
|
||||
break
|
||||
|
||||
if template_file:
|
||||
from openpyxl import load_workbook
|
||||
wb = load_workbook(template_file)
|
||||
ws = wb.active
|
||||
# 양식 서식 유지하면서 데이터 삽입
|
||||
print(f'양식 활용: {template_file}')
|
||||
# TODO: 양식 구조에 맞게 데이터 삽입 로직 작성
|
||||
wb.save('결과_보고서.xlsx')
|
||||
else:
|
||||
# 양식 없으면 JSON으로 저장
|
||||
with open('analysis_result.json', 'w', encoding='utf-8') as f:
|
||||
json.dump(report, f, ensure_ascii=False, indent=2, default=str)
|
||||
|
||||
print(json.dumps(report, ensure_ascii=False, indent=2, default=str))
|
||||
```
|
||||
|
||||
## 지원 분석
|
||||
- 기본 통계 (평균, 중앙값, 표준편차, 분위수)
|
||||
- 결측치 분석
|
||||
- 컬럼별 고유값 분포
|
||||
- 피벗 테이블 / 그룹별 집계
|
||||
- 시트 간 비교 분석
|
||||
- 필터링 및 조건부 추출
|
||||
- 분석 결과를 새 Excel로 내보내기
|
||||
- **양식 파일 기반 보고서 생성** (셀 서식, 병합, 테두리, 차트 영역 유지)
|
||||
|
||||
한국어로 안내하세요. 원본 파일은 수정하지 마세요.
|
||||
Reference in New Issue
Block a user